5.16.7. Regular definitions

Start data section to src/flx_parse.mly[7 /35 ] Next Prev First Last
   603: 
   604: regdef:
   605:   | REGEXP NAME EQUAL re1 SEMI
   606:     {
   607:       let name = snd $2 in
   608:       `AST_regdef (rstoken $1 $5,name,$4)
   609:     }
   610: 
   611: re0:
   612:   | re1 AS NAME              { `REGEXP_group (snd $3, $1) }
   613:   | re1                      { $1 }
   614: 
   615: re1:
   616:   | re1 VBAR re2             { `REGEXP_alt ($1, $3) }
   617:   | re2                      { $1 }
   618: 
   619: re2:
   620:   | re2 re3                  { `REGEXP_seq ($1, $2) }
   621:   | re3                      { $1 }
   622: 
   623: re3:
   624:   | re4 STAR                { `REGEXP_aster $1 }
   625:   | re4 PLUS                 { `REGEXP_seq ($1,`REGEXP_aster $1) }
   626:   | re4 QUEST                { `REGEXP_alt (`REGEXP_epsilon, $1) }
   627:   | re4                      { $1 }
   628: 
   629: re4:
   630:   | STRING                  { let s = snd $1 in `REGEXP_string s }
   631:   | UNDERSCORE              { regexp_underscore }
   632:   | DOT                     { regexp_dot }
   633:   | LPAR re0 RPAR           { $2 }
   634:   | LSQB charset RSQB       { regexp_of_charset $2 }
   635:   | LSQB CIRCUMFLEX charset RSQB { regexp_of_charset (charset_inv $3) }
   636:   | re_name                 { `REGEXP_name $1 }
   637: 
   638: re_name:
   639:   | re_name COLONCOLON NAME
   640:     {
   641:       let e = ($1 :> expr_t) in
   642:       let sr = rsrange (src_of_expr e) (slift (fst $3)) in
   643:       `AST_lookup (sr, (e, snd $3,[]))
   644:     }
   645:   | NAME { `AST_name (slift (fst $1), snd $1,[]) }
   646: 
   647: charset0:
   648:   | INTEGER MINUS INTEGER
   649:     {
   650:       let
   651:         a = match $1 with _,_,x -> Big_int.int_of_big_int x and
   652:         b = match $3 with _,_,x -> Big_int.int_of_big_int x
   653:       in
   654:       charset_of_int_range a b
   655:     }
   656:   | STRING MINUS STRING     { charset_of_range (snd $1) (snd $3) }
   657:   | STRING                  { charset_of_string (snd $1) }
   658:   | INTEGER
   659:     {
   660:       let a = match $1 with _,_,x -> Big_int.int_of_big_int x in
   661:       charset_of_int_range a a
   662:     }
   663: charset:
   664:   | charset charset0        { charset_union $1 $2 }
   665:   | charset0                { $1 }
   666: 
End data section to src/flx_parse.mly[7]


5.16.7.1. Abstract Type
5.16.7.2. Union Binding
5.16.7.3. Struct Binding
5.16.7.4. Abstract Constant Binding
5.16.7.5. Binding Header Definition
5.16.7.6. Inline C++ Code Definition
5.16.7.7. Type Alias
5.16.7.8. Export
5.16.7.9. Open
5.16.7.10. Macro Definition
5.16.7.11. Function and Procedure Definition
5.16.7.12. Object
5.16.7.13. Assert
5.16.7.14. Goto and Label
5.16.7.15. Read Statement
5.16.7.16. Module Definition
5.16.7.17. Variable and Constant Declaration
5.16.7.18. Function or Procedure Return
5.16.7.19. Procedure Call
5.16.7.20. Place Holder
5.16.7.21. Conditional Statements
5.16.7.22. Regular expression matching
5.16.7.23. Pattern Matching