fix parser for special groups
parent
ae8254c0fd
commit
b912a73509
|
@ -151,6 +151,8 @@ ERROR: bad-special-group string ;
|
||||||
DEFER: nested-parse-regexp
|
DEFER: nested-parse-regexp
|
||||||
: (parse-special-group) ( -- )
|
: (parse-special-group) ( -- )
|
||||||
read1 {
|
read1 {
|
||||||
|
{ [ dup CHAR: # = ]
|
||||||
|
[ drop nested-parse-regexp pop-stack drop ] }
|
||||||
{ [ dup CHAR: : = ]
|
{ [ dup CHAR: : = ]
|
||||||
[ drop nested-parse-regexp pop-stack make-non-capturing-group ] }
|
[ drop nested-parse-regexp pop-stack make-non-capturing-group ] }
|
||||||
{ [ dup CHAR: = = ]
|
{ [ dup CHAR: = = ]
|
||||||
|
@ -385,25 +387,25 @@ DEFER: handle-left-bracket
|
||||||
: nested-parse-regexp ( -- )
|
: nested-parse-regexp ( -- )
|
||||||
beginning-of-group push-stack (parse-regexp) ;
|
beginning-of-group push-stack (parse-regexp) ;
|
||||||
|
|
||||||
: ((parse-regexp)) ( token -- )
|
: ((parse-regexp)) ( token -- ? )
|
||||||
{
|
{
|
||||||
{ CHAR: . [ handle-dot ] }
|
{ CHAR: . [ handle-dot t ] }
|
||||||
{ CHAR: ( [ handle-left-parenthesis ] }
|
{ CHAR: ( [ handle-left-parenthesis t ] }
|
||||||
{ CHAR: ) [ handle-right-parenthesis ] }
|
{ CHAR: ) [ handle-right-parenthesis f ] }
|
||||||
{ CHAR: | [ handle-pipe ] }
|
{ CHAR: | [ handle-pipe t ] }
|
||||||
{ CHAR: ? [ handle-question ] }
|
{ CHAR: ? [ handle-question t ] }
|
||||||
{ CHAR: * [ handle-star ] }
|
{ CHAR: * [ handle-star t ] }
|
||||||
{ CHAR: + [ handle-plus ] }
|
{ CHAR: + [ handle-plus t ] }
|
||||||
{ CHAR: { [ handle-left-brace ] }
|
{ CHAR: { [ handle-left-brace t ] }
|
||||||
{ CHAR: [ [ handle-left-bracket ] }
|
{ CHAR: [ [ handle-left-bracket t ] }
|
||||||
{ CHAR: ^ [ handle-front-anchor ] }
|
{ CHAR: ^ [ handle-front-anchor t ] }
|
||||||
{ CHAR: $ [ handle-back-anchor ] }
|
{ CHAR: $ [ handle-back-anchor t ] }
|
||||||
{ CHAR: \ [ handle-escape ] }
|
{ CHAR: \ [ handle-escape t ] }
|
||||||
[ <constant> push-stack ]
|
[ <constant> push-stack t ]
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
: (parse-regexp) ( -- )
|
: (parse-regexp) ( -- )
|
||||||
read1 [ ((parse-regexp)) (parse-regexp) ] when* ;
|
read1 [ ((parse-regexp)) [ (parse-regexp) ] when ] when* ;
|
||||||
|
|
||||||
: parse-regexp ( regexp -- )
|
: parse-regexp ( regexp -- )
|
||||||
dup current-regexp [
|
dup current-regexp [
|
||||||
|
|
Loading…
Reference in New Issue