Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
why3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Why3
why3
Commits
382c98bd
Commit
382c98bd
authored
7 years ago
by
Andrei Paskevich
Browse files
Options
Downloads
Patches
Plain Diff
Lexer: handle (*) entirely in the lexer
this avoids handling LEFTPAR_STAR_RIGHTPAR in the parser
parent
3ead22d3
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/driver/driver_lexer.mll
+10
-5
10 additions, 5 deletions
src/driver/driver_lexer.mll
src/driver/driver_parser.mly
+1
-2
1 addition, 2 deletions
src/driver/driver_parser.mly
src/parser/lexer.mll
+9
-3
9 additions, 3 deletions
src/parser/lexer.mll
src/parser/parser.mly
+1
-6
1 addition, 6 deletions
src/parser/parser.mly
with
21 additions
and
16 deletions
src/driver/driver_lexer.mll
+
10
−
5
View file @
382c98bd
...
...
@@ -52,7 +52,6 @@
"converter"
,
CONVERTER
;
"literal"
,
LITERAL
;
]
}
let
space
=
[
'
'
'\t'
'\r'
]
...
...
@@ -65,12 +64,18 @@ let op_char = ['=' '<' '>' '~' '+' '-' '*' '/' '%'
rule
token
=
parse
|
'\n'
{
new_line
lexbuf
;
token
lexbuf
}
{
Lexing
.
new_line
lexbuf
;
token
lexbuf
}
|
space
+
{
token
lexbuf
}
|
"(*)"
{
LEFTPAR_STAR_RIGHTPAR
}
|
"(*"
|
"(**)"
{
token
lexbuf
}
|
"(*(*"
{
Lexlib
.
comment
lexbuf
;
Lexlib
.
comment
lexbuf
;
token
lexbuf
}
|
"(*"
'\n'
{
Lexing
.
new_line
lexbuf
;
Lexlib
.
comment
lexbuf
;
token
lexbuf
}
|
"(*(*)"
|
"(*"
eof
|
"(*"
[
^
'
)
'
]
{
Lexlib
.
comment
lexbuf
;
token
lexbuf
}
|
'
_'
{
UNDERSCORE
}
...
...
This diff is collapsed.
Click to expand it.
src/driver/driver_parser.mly
+
1
−
2
View file @
382c98bd
...
...
@@ -26,7 +26,7 @@
%
token
BLACKLIST
%
token
MODULE
EXCEPTION
VAL
CONVERTER
LITERAL
%
token
FUNCTION
PREDICATE
TYPE
PROP
ALL
FILENAME
TRANSFORM
PLUGIN
%
token
LEFTPAR_STAR_RIGHTPAR
COMMA
CONSTANT
%
token
COMMA
CONSTANT
%
token
LEFTSQ
RIGHTSQ
LARROW
%
nonassoc
SYNTAX
REMOVE
PRELUDE
...
...
@@ -133,7 +133,6 @@ ident:
ident_rich
:
|
ident
{
$
1
}
|
LEFTPAR_STAR_RIGHTPAR
{
Ident
.
infix
"*"
}
|
LEFTPAR
operator
RIGHTPAR
{
$
2
}
operator
:
...
...
This diff is collapsed.
Click to expand it.
src/parser/lexer.mll
+
9
−
3
View file @
382c98bd
...
...
@@ -166,9 +166,15 @@ rule token = parse
([
'
p'
'
P'
]
([
'
-
'
'
+
'
]
?
digit
+
as
e
))
?
{
REAL
(
Number
.
real_const_hex
i
f
(
Opt
.
map
Lexlib
.
remove_leading_plus
e
))
}
|
"(*)"
{
LEFTPAR_STAR_RIGHTPAR
}
|
"(*"
|
"(**)"
{
token
lexbuf
}
|
"(*(*"
{
Lexlib
.
comment
lexbuf
;
Lexlib
.
comment
lexbuf
;
token
lexbuf
}
|
"(*"
'\n'
{
Lexing
.
new_line
lexbuf
;
Lexlib
.
comment
lexbuf
;
token
lexbuf
}
|
"(*(*)"
|
"(*"
eof
|
"(*"
[
^
'
)
'
]
{
Lexlib
.
comment
lexbuf
;
token
lexbuf
}
|
"'"
(
lident
as
id
)
{
QUOTE_LIDENT
id
}
...
...
This diff is collapsed.
Click to expand it.
src/parser/parser.mly
+
1
−
6
View file @
382c98bd
...
...
@@ -147,7 +147,7 @@
%
token
BAR
%
token
COLON
COMMA
%
token
DOT
DOTDOT
EQUAL
LT
GT
LTGT
MINUS
%
token
LEFTPAR
LEFTPAR_STAR_RIGHTPAR
LEFTSQ
%
token
LEFTPAR
LEFTSQ
%
token
LARROW
LRARROW
OR
%
token
RIGHTPAR
RIGHTSQ
%
token
UNDERSCORE
...
...
@@ -1183,11 +1183,6 @@ lident_rich:
lident_op_id
:
|
LEFTPAR
lident_op
RIGHTPAR
{
mk_id
$
2
$
startpos
(
$
2
)
$
endpos
(
$
2
)
}
|
LEFTPAR_STAR_RIGHTPAR
{
(* parentheses are removed from the location *)
let
s
=
let
s
=
$
startpos
in
{
s
with
Lexing
.
pos_cnum
=
s
.
Lexing
.
pos_cnum
+
1
}
in
let
e
=
let
e
=
$
endpos
in
{
e
with
Lexing
.
pos_cnum
=
e
.
Lexing
.
pos_cnum
-
1
}
in
mk_id
(
Ident
.
infix
"*"
)
s
e
}
lident_op
:
|
op_symbol
{
Ident
.
infix
$
1
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment