Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
trdthg committed Jul 24, 2024
1 parent 3e94824 commit be519cf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
7 changes: 2 additions & 5 deletions src/lib/lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,10 @@ let tyvar_start = '\''
(* Ensure an operator cannot start with comment openings *)
let oper_char = ['!''%''&''*''+''-''.''/'':''<''=''>''@''^''|']
let oper_char_no_slash = ['!''%''&''*''+''-''.'':''<''=''>''@''^''|']
let oper_char_no_star = ['!''%''&''+''-''.''/'':''<''=''>''@''^''|']
let oper_char_no_slash_star = ['!''%''&''+''-''.'':''<''=''>''@''^''|']

let operator_any_start = (oper_char (oper_char_no_slash_star oper_char)*)
| (oper_char oper_char_no_slash_star)*
let operator_no_slash_start = (oper_char_no_slash (oper_char oper_char_no_slash_star)*)
| (oper_char_no_slash_star oper_char)*
let operator = (operator_any_start | operator_no_slash_start) ('_' ident)?
let operator = ((oper_char_no_slash_star* ['/']? oper_char_no_slash_star*) | oper_char_no_slash*) ('_' ident)?
let escape_sequence = ('\\' ['\\''\"''\'''n''t''b''r']) | ('\\' digit digit digit) | ('\\' 'x' hexdigit hexdigit)
let lchar = [^'\n']

Expand Down
17 changes: 8 additions & 9 deletions test/format/default/operator.expect
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ $include <prelude.sail>
//* line_block_comment */
infix 4 ===_u
infix 4 ===/_u
infix 4 /=/=/=

infix 4 ===*_u
val operator ===/_u : forall 'n. (int('n), int('n)) -> bool
Expand All @@ -25,6 +24,9 @@ function operator =/(x, y) = x == y

infix 4 =

// comment
infix 4 </>

// comment
infix 4 =/

Expand All @@ -33,10 +35,7 @@ infix 4 ==/
infix 4 -/-

//comment
infix 4 -/-/

//comment
infix 4 /-*
infix 4 /--

//comment
infixl 4 =
Expand All @@ -49,10 +48,10 @@ infixl 4 ==/
infixl 4 -/-

//comment
infixl 4 -/-/
infixl 4 -/-

//comment
infixl 4 /-*
infixl 4 /--

//comment
infixr 4 =
Expand All @@ -65,10 +64,10 @@ infixr 4 ==/
infixr 4 -/-

//comment
infixr 4 -/-/
infixr 4 -/-

//comment
infixr 4 /-*
infixr 4 /--

//comment
function f () = {
Expand Down
13 changes: 6 additions & 7 deletions test/format/operator.sail
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ $include <prelude.sail>

infix 4 ===_u
infix 4 ===/_u
infix 4 /=/=/=

infix 4 ===*_u
val operator ===/_u : forall 'n. (int('n), int('n)) -> bool
Expand All @@ -29,25 +28,25 @@ val operator =/ : forall 'n. (int('n), int('n)) -> bool
function operator =/(x, y) = x == y

infix 4 = // comment
infix 4 </> // comment
infix 4 =/ // comment
infix 4 ==/
infix 4 -/- //comment
infix 4 -/-/ //comment
infix 4 /-*//comment
infix 4 /-- //comment

infixl 4 = // comment
infixl 4 =/ // comment
infixl 4 ==/
infixl 4 -/- //comment
infixl 4 -/-/ //comment
infixl 4 /-*//comment
infixl 4 -/- //comment
infixl 4 /-- //comment

infixr 4 = // comment
infixr 4 =/ // comment
infixr 4 ==/
infixr 4 -/- //comment
infixr 4 -/-/ //comment
infixr 4 /-*//comment
infixr 4 -/- //comment
infixr 4 /-- //comment

function f () = {
if op_eq2_with_block_comment /**/== /**/ 1 then { 1 };
Expand Down

0 comments on commit be519cf

Please sign in to comment.