Commits

HongboZhang  committed bdb1bd5

lexer hacking not finished yet

  • Participants
  • Parent commits 973ffcb

Comments (0)

Files changed (1)

File camlp4/Camlp4/Struct/Lexer.mll

     exception E of t
 
     open Format
-
+    let opt_char : char option Stack.t = Stack.empty
     let print ppf =
       function
       | Illegal_character c ->
     | symbolchar* as tok                                   { SYMBOL("<:" ^ tok) }
 
   and quotation c = parse
+    | '<' (':' ident)? ('@' locname)? '<'  (symbol_char as chr)
+                                             {                          store c ;
+                                                      with_curr_loc quotation c ;
+                                                  Stack.push (Some chr) opt_char;
+                                                              parse quotation c }
+      
     | '<' (':' ident)? ('@' locname)? '<'    {                          store c ;
                                                       with_curr_loc quotation c ;
+                                            Stack.push None opt_char;                   
                                                               parse quotation c }
-    | ">>"                                                            { store c }
+    | ">>" (symbol_char as chr)
+                                             { if Some chr = !opt_char then
+                                               store c
+                                              else
+                                             }
+    | ">>"                                  { if !opt_char = None then
+                                                 store c
+                                              else
+                                                 store_parse quotation c
+                                            }
+
     | eof                                  { err Unterminated_quotation (loc c) }
     | newline                                     { update_loc c None 1 false 0 ;
                                                         store_parse quotation c }