diff --git a/src/passes/01-parser/cameligo/AST.ml b/src/passes/01-parser/cameligo/AST.ml index d55788bd2..80c8b84ad 100644 --- a/src/passes/01-parser/cameligo/AST.ml +++ b/src/passes/01-parser/cameligo/AST.ml @@ -401,6 +401,8 @@ and cond_expr = { } and code_insert = { + lbracket : lbracket; + percent : percent; language : string reg; code : expr; rbracket : rbracket; diff --git a/src/passes/01-parser/cameligo/LexToken.mli b/src/passes/01-parser/cameligo/LexToken.mli index 65c8ff340..55034607e 100644 --- a/src/passes/01-parser/cameligo/LexToken.mli +++ b/src/passes/01-parser/cameligo/LexToken.mli @@ -42,6 +42,7 @@ type t = | PLUS of Region.t (* "+" *) | SLASH of Region.t (* "/" *) | TIMES of Region.t (* "*" *) +| PERCENT of Region.t (* "%" *) (* Compounds *) @@ -87,7 +88,6 @@ type t = | Verbatim of string Region.reg | Bytes of (string * Hex.t) Region.reg | Attr of string Region.reg -| Insert of string Region.reg (* Keywords *) @@ -155,7 +155,6 @@ val mk_verbatim : lexeme -> Region.t -> token val mk_bytes : lexeme -> Region.t -> token val mk_constr : lexeme -> Region.t -> token val mk_attr : string -> lexeme -> Region.t -> (token, attr_err) result -val mk_insert : lexeme -> Region.t -> token val eof : Region.t -> token (* Predicates *) diff --git a/src/passes/01-parser/cameligo/LexToken.mll b/src/passes/01-parser/cameligo/LexToken.mll index c57e3076e..aea43edba 100644 --- a/src/passes/01-parser/cameligo/LexToken.mll +++ b/src/passes/01-parser/cameligo/LexToken.mll @@ -26,6 +26,7 @@ type t = | PLUS of Region.t (* "+" *) | SLASH of Region.t (* "/" *) | TIMES of Region.t (* "*" *) +| PERCENT of Region.t (* "%" *) (* Compounds *) @@ -71,7 +72,6 @@ type t = | Verbatim of string Region.reg | Bytes of (string * Hex.t) Region.reg | Attr of string Region.reg -| Insert of string Region.reg (* Keywords *) @@ -131,8 +131,6 @@ let proj_token = function region, sprintf "Constr %s" value | Attr Region.{region; value} -> region, sprintf "Attr \"%s\"" value -| Insert Region.{region; value} -> - region, sprintf "Insert \"%s\"" value (* Symbols *) @@ -143,6 +141,7 @@ let proj_token = function | PLUS region -> region, "PLUS" | SLASH region -> region, "SLASH" | TIMES region -> region, "TIMES" +| PERCENT region -> region, "PERCENT" | LPAR region -> region, "LPAR" | RPAR region -> region, "RPAR" | LBRACKET region -> region, "LBRACKET" @@ -207,7 +206,6 @@ let to_lexeme = function | Ident id -> id.Region.value | Constr id -> id.Region.value | Attr a -> a.Region.value -| Insert i -> i.Region.value (* Symbols *) @@ -218,6 +216,7 @@ let to_lexeme = function | PLUS _ -> "+" | SLASH _ -> "/" | TIMES _ -> "*" +| PERCENT _ -> "%" | LPAR _ -> "(" | RPAR _ -> ")" | LBRACKET _ -> "[" @@ -479,6 +478,7 @@ let mk_sym lexeme region = | "-" -> Ok (MINUS region) | "*" -> Ok (TIMES region) | "/" -> Ok (SLASH region) + | "%" -> Ok (PERCENT region) | "<" -> Ok (LT region) | "<=" -> Ok (LE region) | ">" -> Ok (GT region) @@ -512,9 +512,6 @@ let mk_attr header lexeme region = if header = "[@" then Error Invalid_attribute else Ok (Attr Region.{value=lexeme; region}) -let mk_insert lexeme region = - Insert Region.{value=lexeme;region} - (* Predicates *) let is_string = function String _ -> true | _ -> false diff --git a/src/passes/01-parser/cameligo/ParToken.mly b/src/passes/01-parser/cameligo/ParToken.mly index 0ac44271b..898d6f571 100644 --- a/src/passes/01-parser/cameligo/ParToken.mly +++ b/src/passes/01-parser/cameligo/ParToken.mly @@ -14,14 +14,14 @@ %token Ident "" %token Constr "" %token Attr "" -%token Insert "" (* Symbols *) -%token MINUS "-" -%token PLUS "+" -%token SLASH "/" -%token TIMES "*" +%token MINUS "-" +%token PLUS "+" +%token SLASH "/" +%token TIMES "*" +%token PERCENT "%" %token LPAR "(" %token RPAR ")" diff --git a/src/passes/01-parser/cameligo/Parser.mly b/src/passes/01-parser/cameligo/Parser.mly index 9e1471a2d..9dca6a5c4 100644 --- a/src/passes/01-parser/cameligo/Parser.mly +++ b/src/passes/01-parser/cameligo/Parser.mly @@ -709,10 +709,12 @@ seq_expr: disj_expr_level | if_then_else (seq_expr) { $1 } code_insert: - Insert expr "]" { - let region = cover $1.region $3 in + "[" "%" Constr expr "]" { + let region = cover $1 $5 in let value = { - language =$1; - code =$2; - rbracket =$3} + lbracket =$1; + percent =$2; + language =$3; + code =$4; + rbracket =$5} in {region; value} } diff --git a/src/passes/01-parser/cameligo/ParserLog.ml b/src/passes/01-parser/cameligo/ParserLog.ml index 579ba3b22..ec5284852 100644 --- a/src/passes/01-parser/cameligo/ParserLog.ml +++ b/src/passes/01-parser/cameligo/ParserLog.ml @@ -520,7 +520,9 @@ and print_record_expr state e = print_ne_injection state print_field_assign e and print_code_insert state {value; _} = - let {language;code;rbracket} : code_insert = value in + let {lbracket;percent;language;code;rbracket} : code_insert = value in + print_token state lbracket "["; + print_token state percent "%"; print_string state language; print_expr state code; print_token state rbracket "]" diff --git a/src/passes/01-parser/pascaligo/AST.ml b/src/passes/01-parser/pascaligo/AST.ml index 83a509f52..ff9808302 100644 --- a/src/passes/01-parser/pascaligo/AST.ml +++ b/src/passes/01-parser/pascaligo/AST.ml @@ -438,6 +438,8 @@ and for_collect = { } and code_insert = { + lbracket : lbracket; + percent : percent; language : string reg; code : expr; rbracket : rbracket; diff --git a/src/passes/01-parser/pascaligo/LexToken.mli b/src/passes/01-parser/pascaligo/LexToken.mli index 1adc7db2d..86c28c4a3 100644 --- a/src/passes/01-parser/pascaligo/LexToken.mli +++ b/src/passes/01-parser/pascaligo/LexToken.mli @@ -44,7 +44,6 @@ type t = | Mutez of (lexeme * Z.t) Region.reg | Ident of lexeme Region.reg | Constr of lexeme Region.reg -| Insert of lexeme Region.reg (* Symbols *) @@ -74,6 +73,7 @@ type t = | DOT of Region.t (* "." *) | WILD of Region.t (* "_" *) | CAT of Region.t (* "^" *) +| PERCENT of Region.t (* "%" *) (* Keywords *) @@ -162,7 +162,6 @@ val mk_verbatim : lexeme -> Region.t -> token val mk_bytes : lexeme -> Region.t -> token val mk_constr : lexeme -> Region.t -> token val mk_attr : string -> lexeme -> Region.t -> (token, attr_err) result -val mk_insert : lexeme -> Region.t -> token val eof : Region.t -> token (* Predicates *) diff --git a/src/passes/01-parser/pascaligo/LexToken.mll b/src/passes/01-parser/pascaligo/LexToken.mll index 56401eccc..33e0bf937 100644 --- a/src/passes/01-parser/pascaligo/LexToken.mll +++ b/src/passes/01-parser/pascaligo/LexToken.mll @@ -32,7 +32,6 @@ type t = | Mutez of (lexeme * Z.t) Region.reg | Ident of lexeme Region.reg | Constr of lexeme Region.reg -| Insert of lexeme Region.reg (* Symbols *) @@ -62,6 +61,7 @@ type t = | DOT of Region.t | WILD of Region.t | CAT of Region.t +| PERCENT of Region.t (* "%" *) (* Keywords *) @@ -142,9 +142,6 @@ let proj_token = function | Constr Region.{region; value} -> region, sprintf "Constr \"%s\"" value -| Insert Region.{region; value} -> - region, sprintf "Insert \"%s\"" value - (* | Attr {header; string={region; value}} -> region, sprintf "Attr (\"%s\",\"%s\")" header value @@ -178,6 +175,7 @@ let proj_token = function | DOT region -> region, "DOT" | WILD region -> region, "WILD" | CAT region -> region, "CAT" +| PERCENT region -> region, "PERCENT" (* Keywords *) @@ -242,7 +240,6 @@ let to_lexeme = function | Mutez i -> fst i.Region.value | Ident id | Constr id -> id.Region.value -| Insert i -> i.Region.value (* Symbols *) @@ -272,6 +269,7 @@ let to_lexeme = function | DOT _ -> "." | WILD _ -> "_" | CAT _ -> "^" +| PERCENT _ -> "%" (* Keywords *) @@ -523,6 +521,7 @@ let mk_sym lexeme region = | "-" -> Ok (MINUS region) | "*" -> Ok (TIMES region) | "/" -> Ok (SLASH region) + | "%" -> Ok (PERCENT region) | "<" -> Ok (LT region) | "<=" -> Ok (LE region) | ">" -> Ok (GT region) @@ -553,11 +552,6 @@ type attr_err = Invalid_attribute let mk_attr _ _ _ = Error Invalid_attribute -(* Raw Code Insertion *) - -let mk_insert lexeme region = - Insert Region.{value=lexeme;region} - (* Predicates *) let is_string = function String _ -> true | _ -> false diff --git a/src/passes/01-parser/pascaligo/ParToken.mly b/src/passes/01-parser/pascaligo/ParToken.mly index f51dfc30e..1fc3de168 100644 --- a/src/passes/01-parser/pascaligo/ParToken.mly +++ b/src/passes/01-parser/pascaligo/ParToken.mly @@ -13,7 +13,6 @@ %token <(LexToken.lexeme * Z.t) Region.reg> Mutez "" %token Ident "" %token Constr "" -%token Insert "" (* Symbols *) @@ -43,6 +42,7 @@ %token DOT "." %token WILD "_" %token CAT "^" +%token PERCENT "%" (* Keywords *) diff --git a/src/passes/01-parser/pascaligo/Parser.mly b/src/passes/01-parser/pascaligo/Parser.mly index d89ca566b..435213727 100644 --- a/src/passes/01-parser/pascaligo/Parser.mly +++ b/src/passes/01-parser/pascaligo/Parser.mly @@ -975,12 +975,14 @@ update_record: in {region; value} } code_insert_expr: - Insert expr "]" { - let region = cover $1.region $3 in + "[" "%" Constr expr "]" { + let region = cover $1 $5 in let value = { - language =$1; - code =$2; - rbracket =$3} + lbracket =$1; + percent =$2; + language =$3; + code =$4; + rbracket =$5} in {region; value} } field_assignment: diff --git a/src/passes/01-parser/pascaligo/ParserLog.ml b/src/passes/01-parser/pascaligo/ParserLog.ml index de77a5bb0..6cca06237 100644 --- a/src/passes/01-parser/pascaligo/ParserLog.ml +++ b/src/passes/01-parser/pascaligo/ParserLog.ml @@ -231,7 +231,9 @@ and print_fun_expr state {value; _} = print_expr state return and print_code_insert state {value; _} = - let {language;code;rbracket} : code_insert = value in + let {lbracket;percent;language;code;rbracket} : code_insert = value in + print_token state lbracket "["; + print_token state percent "%"; print_string state language; print_expr state code; print_token state rbracket "]" diff --git a/src/passes/01-parser/pascaligo/error.messages.checked-in b/src/passes/01-parser/pascaligo/error.messages.checked-in index 3cad43084..5d3861419 100644 --- a/src/passes/01-parser/pascaligo/error.messages.checked-in +++ b/src/passes/01-parser/pascaligo/error.messages.checked-in @@ -32,6 +32,7 @@ interactive_expr: BigMap LBRACKET With ## ## Ends in an error in state: 140. ## +## code_insert_expr -> LBRACKET . PERCENT Constr expr RBRACKET [ TIMES SLASH PLUS Or NE Mod MINUS LT LE GT GE EQ Contains CONS CAT And ARROW ] ## injection(BigMap,binding) -> BigMap LBRACKET . sep_or_term_list(binding,SEMI) RBRACKET [ VBAR Type To Then TIMES Step SLASH SEMI Recursive RPAR RBRACKET RBRACE PLUS Or Of NE Mod MINUS LT LE GT GE Function From End Else EQ EOF Contains Const CONS COMMA COLON CAT Block Begin Attributes And ARROW ] ## injection(BigMap,binding) -> BigMap LBRACKET . RBRACKET [ VBAR Type To Then TIMES Step SLASH SEMI Recursive RPAR RBRACKET RBRACE PLUS Or Of NE Mod MINUS LT LE GT GE Function From End Else EQ EOF Contains Const CONS COMMA COLON CAT Block Begin Attributes And ARROW ] ## @@ -876,7 +877,7 @@ interactive_expr: Function LPAR With interactive_expr: Function With ## -## Ends in an error in state: 111. +## Ends in an error in state: 120. ## ## fun_expr -> Function . parameters COLON type_expr Is expr [ VBAR Type To Then Step SEMI Recursive RPAR RBRACKET RBRACE Of Function From End Else EOF Const COMMA Block Begin Attributes ARROW ] ## @@ -1228,7 +1229,7 @@ interactive_expr: Ident With Record Ident While interactive_expr: Ident With Record Ident With ## -## Ends in an error in state: 166. +## Ends in an error in state: 169. ## ## field_path_assignment -> path . EQ expr [ SEMI RBRACKET End ] ## @@ -1576,6 +1577,7 @@ interactive_expr: List LBRACKET With ## ## Ends in an error in state: 359. ## +## code_insert_expr -> LBRACKET . PERCENT Constr expr RBRACKET [ TIMES SLASH SEMI PLUS Or NE Mod MINUS LT LE GT GE End EQ Contains CONS CAT And ] ## injection(List,expr) -> List LBRACKET . sep_or_term_list(expr,SEMI) RBRACKET [ VBAR Type To Then TIMES Step SLASH SEMI Recursive RPAR RBRACKET RBRACE PLUS Or Of NE Mod MINUS LT LE GT GE Function From End Else EQ EOF Contains Const CONS COMMA COLON CAT Block Begin Attributes And ARROW ] ## injection(List,expr) -> List LBRACKET . RBRACKET [ VBAR Type To Then TIMES Step SLASH SEMI Recursive RPAR RBRACKET RBRACE PLUS Or Of NE Mod MINUS LT LE GT GE Function From End Else EQ EOF Contains Const CONS COMMA COLON CAT Block Begin Attributes And ARROW ] ## @@ -1675,6 +1677,7 @@ interactive_expr: Map LBRACKET With ## ## Ends in an error in state: 376. ## +## code_insert_expr -> LBRACKET . PERCENT Constr expr RBRACKET [ TIMES SLASH PLUS Or NE Mod MINUS LT LE GT GE EQ Contains CONS CAT And ARROW ] ## injection(Map,binding) -> Map LBRACKET . sep_or_term_list(binding,SEMI) RBRACKET [ VBAR Type To Then TIMES Step SLASH SEMI Recursive RPAR RBRACKET RBRACE PLUS Or Of NE Mod MINUS LT LE GT GE Function From End Else EQ EOF Contains Const CONS COMMA COLON CAT Block Begin Attributes And ARROW ] ## injection(Map,binding) -> Map LBRACKET . RBRACKET [ VBAR Type To Then TIMES Step SLASH SEMI Recursive RPAR RBRACKET RBRACE PLUS Or Of NE Mod MINUS LT LE GT GE Function From End Else EQ EOF Contains Const CONS COMMA COLON CAT Block Begin Attributes And ARROW ] ## @@ -2109,6 +2112,7 @@ interactive_expr: Set LBRACKET With ## ## Ends in an error in state: 398. ## +## code_insert_expr -> LBRACKET . PERCENT Constr expr RBRACKET [ TIMES SLASH SEMI PLUS Or NE Mod MINUS LT LE GT GE End EQ Contains CONS CAT And ] ## injection(Set,expr) -> Set LBRACKET . sep_or_term_list(expr,SEMI) RBRACKET [ VBAR Type To Then TIMES Step SLASH SEMI Recursive RPAR RBRACKET RBRACE PLUS Or Of NE Mod MINUS LT LE GT GE Function From End Else EQ EOF Contains Const CONS COMMA COLON CAT Block Begin Attributes And ARROW ] ## injection(Set,expr) -> Set LBRACKET . RBRACKET [ VBAR Type To Then TIMES Step SLASH SEMI Recursive RPAR RBRACKET RBRACE PLUS Or Of NE Mod MINUS LT LE GT GE Function From End Else EQ EOF Contains Const CONS COMMA COLON CAT Block Begin Attributes And ARROW ] ## @@ -3487,6 +3491,7 @@ contract: Function Ident LPAR Const Ident COLON Ident RPAR COLON String Is Begin ## ## Ends in an error in state: 441. ## +## code_insert_expr -> LBRACKET . PERCENT Constr expr RBRACKET [ TIMES SLASH PLUS Or NE Mod MINUS LT LE GT GE EQ Contains CONS CAT And ARROW ] ## ne_injection(Map,binding) -> Map LBRACKET . sep_or_term_list(binding,SEMI) RBRACKET [ VBAR SEMI RBRACKET RBRACE End Else ] ## ## The known suffix of the stack is as follows: @@ -3656,6 +3661,7 @@ contract: Function Ident LPAR Const Ident COLON Ident RPAR COLON String Is Begin ## ## Ends in an error in state: 429. ## +## code_insert_expr -> LBRACKET . PERCENT Constr expr RBRACKET [ TIMES SLASH SEMI PLUS Or NE Mod MINUS LT LE GT GE End EQ Contains CONS CAT And ] ## ne_injection(Set,expr) -> Set LBRACKET . sep_or_term_list(expr,SEMI) RBRACKET [ VBAR SEMI RBRACKET RBRACE End Else ] ## ## The known suffix of the stack is as follows: @@ -4767,4 +4773,3 @@ contract: With ## - diff --git a/src/passes/01-parser/reasonligo/LexToken.mli b/src/passes/01-parser/reasonligo/LexToken.mli index c0dd48bb1..7a5de35d3 100644 --- a/src/passes/01-parser/reasonligo/LexToken.mli +++ b/src/passes/01-parser/reasonligo/LexToken.mli @@ -35,10 +35,11 @@ type t = (* Arithmetics *) -| MINUS of Region.t (* "-" *) -| PLUS of Region.t (* "+" *) -| SLASH of Region.t (* "/" *) -| TIMES of Region.t (* "*" *) +| MINUS of Region.t (* "-" *) +| PLUS of Region.t (* "+" *) +| SLASH of Region.t (* "/" *) +| TIMES of Region.t (* "*" *) +| PERCENT of Region.t (* "%" *) (* Compounds *) @@ -90,7 +91,6 @@ type t = | Verbatim of string Region.reg | Bytes of (string * Hex.t) Region.reg | Attr of string Region.reg -| Insert of string Region.reg (* Keywords *) @@ -154,7 +154,6 @@ val mk_string : lexeme -> Region.t -> token val mk_verbatim : lexeme -> Region.t -> token val mk_bytes : lexeme -> Region.t -> token val mk_constr : lexeme -> Region.t -> token -val mk_insert : lexeme -> Region.t -> token val eof : Region.t -> token (* Predicates *) diff --git a/src/passes/01-parser/reasonligo/LexToken.mll b/src/passes/01-parser/reasonligo/LexToken.mll index 212d274b2..360c23a7a 100644 --- a/src/passes/01-parser/reasonligo/LexToken.mll +++ b/src/passes/01-parser/reasonligo/LexToken.mll @@ -21,10 +21,11 @@ type t = (* Arithmetics *) -| MINUS of Region.t (* "-" *) -| PLUS of Region.t (* "+" *) -| SLASH of Region.t (* "/" *) -| TIMES of Region.t (* "*" *) +| MINUS of Region.t (* "-" *) +| PLUS of Region.t (* "+" *) +| SLASH of Region.t (* "/" *) +| TIMES of Region.t (* "*" *) +| PERCENT of Region.t (* "%" *) (* Compounds *) @@ -76,7 +77,6 @@ type t = | Verbatim of string Region.reg | Bytes of (string * Hex.t) Region.reg | Attr of string Region.reg -| Insert of string Region.reg (* Keywords *) @@ -133,6 +133,7 @@ let proj_token = function | PLUS region -> region, "PLUS" | SLASH region -> region, "SLASH" | TIMES region -> region, "TIMES" +| PERCENT region -> region, "PERCENT" | LPAR region -> region, "LPAR" | RPAR region -> region, "RPAR" | LBRACKET region -> region, "LBRACKET" @@ -170,7 +171,6 @@ let proj_token = function | C_None region -> region, "C_None" | C_Some region -> region, "C_Some" | Attr Region.{region; value} -> region, sprintf "Attr %s" value -| Insert Region.{region; value} -> region, sprintf "Insert %s" value | EOF region -> region, "EOF" let to_lexeme = function @@ -185,7 +185,6 @@ let to_lexeme = function | Ident id -> id.Region.value | Constr id -> id.Region.value | Attr a -> a.Region.value -| Insert i -> i.Region.value (* Symbols *) @@ -194,6 +193,7 @@ let to_lexeme = function | PLUS _ -> "+" | SLASH _ -> "/" | TIMES _ -> "*" +| PERCENT _ -> "%" | LPAR _ -> "(" | RPAR _ -> ")" | LBRACKET _ -> "[" @@ -432,6 +432,7 @@ let mk_sym lexeme region = | "+" -> Ok (PLUS region) | "/" -> Ok (SLASH region) | "*" -> Ok (TIMES region) + | "%" -> Ok (PERCENT region) | "[" -> Ok (LBRACKET region) | "]" -> Ok (RBRACKET region) | "{" -> Ok (LBRACE region) @@ -487,11 +488,6 @@ let mk_attr header lexeme region = Ok (Attr Region.{value=lexeme; region}) else Error Invalid_attribute -(* Raw Code Insertion *) - -let mk_insert lexeme region = - Insert Region.{value=lexeme;region} - (* Predicates *) let is_string = function String _ -> true | _ -> false diff --git a/src/passes/01-parser/reasonligo/ParToken.mly b/src/passes/01-parser/reasonligo/ParToken.mly index f4b146009..13b56efb8 100644 --- a/src/passes/01-parser/reasonligo/ParToken.mly +++ b/src/passes/01-parser/reasonligo/ParToken.mly @@ -14,14 +14,14 @@ %token Ident "" %token Constr "" %token Attr "" -%token Insert "" (* Symbols *) -%token MINUS "-" -%token PLUS "+" -%token SLASH "/" -%token TIMES "*" +%token MINUS "-" +%token PLUS "+" +%token SLASH "/" +%token TIMES "*" +%token PERCENT "%" %token LPAR "(" %token RPAR ")" diff --git a/src/passes/01-parser/reasonligo/Parser.mly b/src/passes/01-parser/reasonligo/Parser.mly index 630a4ec8a..a564c9152 100644 --- a/src/passes/01-parser/reasonligo/Parser.mly +++ b/src/passes/01-parser/reasonligo/Parser.mly @@ -921,12 +921,14 @@ update_record: in {region; value} } code_insert: - Insert expr "]" { - let region = cover $1.region $3 in + "[" "%" Constr expr "]" { + let region = cover $1 $5 in let value = { - language =$1; - code =$2; - rbracket =$3} + lbracket =$1; + percent =$2; + language =$3; + code =$4; + rbracket =$5} in {region; value} } expr_with_let_expr: diff --git a/src/passes/01-parser/reasonligo/error.messages.checked-in b/src/passes/01-parser/reasonligo/error.messages.checked-in index 1afe0b7f7..96925e302 100644 --- a/src/passes/01-parser/reasonligo/error.messages.checked-in +++ b/src/passes/01-parser/reasonligo/error.messages.checked-in @@ -3794,4 +3794,3 @@ contract: WILD ## - diff --git a/src/passes/01-parser/shared/Lexer.mli b/src/passes/01-parser/shared/Lexer.mli index f8094f1ca..fd94773ed 100644 --- a/src/passes/01-parser/shared/Lexer.mli +++ b/src/passes/01-parser/shared/Lexer.mli @@ -79,7 +79,6 @@ module type TOKEN = val mk_bytes : lexeme -> Region.t -> token val mk_constr : lexeme -> Region.t -> token val mk_attr : string -> lexeme -> Region.t -> (token, attr_err) result - val mk_insert : lexeme -> Region.t -> token val eof : Region.t -> token (* Predicates *) diff --git a/src/passes/01-parser/shared/Lexer.mll b/src/passes/01-parser/shared/Lexer.mll index 136a0fd07..2d432891a 100644 --- a/src/passes/01-parser/shared/Lexer.mll +++ b/src/passes/01-parser/shared/Lexer.mll @@ -43,7 +43,6 @@ module type TOKEN = val mk_bytes : lexeme -> Region.t -> token val mk_constr : lexeme -> Region.t -> token val mk_attr : string -> lexeme -> Region.t -> (token, attr_err) result - val mk_insert : lexeme -> Region.t -> token val eof : Region.t -> token (* Predicates *) @@ -269,11 +268,6 @@ module Make (Token : TOKEN) : (S with module Token = Token) = | Error Token.Invalid_attribute -> fail region Invalid_attribute - let mk_insert insert state buffer = - let region, _, state = state#sync buffer in - let token = Token.mk_insert insert region - in state#enqueue token - let mk_constr state buffer = let region, lexeme, state = state#sync buffer in let token = Token.mk_constr lexeme region @@ -359,7 +353,6 @@ let line_comments = (* #include files *) let string = [^'"' '\\' '\n']* (* For strings of #include *) -let insert = attr (* RULES *) @@ -395,7 +388,6 @@ and scan state = parse | eof { mk_eof state lexbuf } | "[@" (attr as a) "]" { mk_attr "[@" a state lexbuf } | "[@@" (attr as a) "]" { mk_attr "[@@" a state lexbuf } -| "[%" (insert as i) { mk_insert i state lexbuf } (* Management of #include preprocessing directives