From 00a255aa9e3e7c8d3e10cfe9dd106104ffc898a8 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Fri, 8 Mar 2019 16:06:50 +0100 Subject: [PATCH] Changed the line comments to start with "//". The list constructor is now "#". --- LexToken.mll | 4 ++-- Lexer.mll | 8 ++++---- Tests/a.li | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/LexToken.mll b/LexToken.mll index 2e2b1d14d..82fecf27d 100644 --- a/LexToken.mll +++ b/LexToken.mll @@ -246,7 +246,7 @@ let to_lexeme = function | RBRACE _ -> "}" | LBRACKET _ -> "[" | RBRACKET _ -> "]" -| CONS _ -> "<:" +| CONS _ -> "#" | VBAR _ -> "|" | ARROW _ -> "->" | ASS _ -> ":=" @@ -490,7 +490,7 @@ let mk_sym lexeme region = | "}" -> RBRACE region | "[" -> LBRACKET region | "]" -> RBRACKET region - | "<:" -> CONS region + | "#" -> CONS region | "|" -> VBAR region | "->" -> ARROW region | ":=" -> ASS region diff --git a/Lexer.mll b/Lexer.mll index cacbba693..2bbbbf32f 100644 --- a/Lexer.mll +++ b/Lexer.mll @@ -166,7 +166,7 @@ module Make (Token: TOKEN) : (S with module Token = Token) = (* When scanning structured constructs, like strings and comments, we need to keep the region of the opening symbol (like double - quote, "#" or "(*") in order to report any error more + quote, "//" or "(*") in order to report any error more precisely. Since ocamllex is byte-oriented, we need to store the parsed bytes as characters in an accumulator [acc] and also its length [len], so, we are done, it is easy to build the @@ -443,7 +443,7 @@ let esc = "\\n" | "\\\"" | "\\\\" | "\\b" | "\\r" | "\\t" | "\\x" byte let symbol = ';' | ',' | '(' | ')' | '{' | '}' | '[' | ']' - | "<:" | '|' | "->" | ":=" | '=' | ':' + | "#" | '|' | "->" | ":=" | '=' | ':' | "||" | "&&" | '<' | "<=" | '>' | ">=" | "=/=" | '+' | '-' | '*' | '.' | '_' | '^' @@ -482,8 +482,8 @@ and scan state = parse let state = scan_block thread state lexbuf |> push_block in scan state lexbuf } -| '#' { let opening, _, state = sync state lexbuf in - let thread = {opening; len=1; acc=['#']} in +| "//" { let opening, _, state = sync state lexbuf in + let thread = {opening; len=2; acc=['/';'/']} in let state = scan_line thread state lexbuf |> push_line in scan state lexbuf } diff --git a/Tests/a.li b/Tests/a.li index 45304e0a4..2f91d5c0b 100644 --- a/Tests/a.li +++ b/Tests/a.li @@ -3,7 +3,7 @@ type u is t type v is record foo: key; bar: mutez; baz: address end type w is K of (U of int) (*v * u*) -parameter p : v // Line comment +parameter p : v; // Line comment storage w operations u