Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
cdf8e5bc
Commit
cdf8e5bc
authored
5 years ago
by
Patrick Baudin
Browse files
Options
Downloads
Patches
Plain Diff
no semantic change (just reorder some lines)
parent
3c0e2265
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/kernel_services/ast_printing/cil_printer.ml
+38
-33
38 additions, 33 deletions
src/kernel_services/ast_printing/cil_printer.ml
with
38 additions
and
33 deletions
src/kernel_services/ast_printing/cil_printer.ml
+
38
−
33
View file @
cdf8e5bc
...
@@ -158,13 +158,22 @@ let state =
...
@@ -158,13 +158,22 @@ let state =
*)
*)
module
Precedence
=
struct
module
Precedence
=
struct
let
derefStarLevel
=
20
(* 23 [%left DOT ARROW LSQUARE] *)
let
upperLevel
=
110
(* Occurence order in [logic_parser.mly]:
let
indexLevel
=
20
(* 23 [%left DOT ARROW LSQUARE] *)
1 [%right prec_named]
let
arrowLevel
=
20
(* 23 [%left DOT ARROW LSQUARE] *)
2 [%nonassoc TYPENAME] *)
let
addrOfLevel
=
30
(* 21 [%right prec_cast TILDE NOT prec_unary_op] *)
let
questionLevel
=
100
(* Pif, Aquestion:
let
multiplicativeLevel
=
40
(* 20 [%left STAR SLASH PERCENT] *)
4 [%right QUESTION prec_question] *)
let
additiveLevel
=
60
(* 19 [%left PLUS MINUS] *)
let
binderLevel
=
90
(* 3 [%nonassoc prec_forall prec_exists prec_lambda LET] *)
let
comparativeLevel
=
70
(* 17 [%left LT] *)
(* Be careful if you change the relative order of these 3 levels *)
let
or_level
=
85
(* 7 [%left OR] *)
let
xor_level
=
84
(* 8 [%left HATHAT] *)
let
and_level
=
83
(* 9 [%left AND] *)
let
assoc_connector_level
x
=
and_level
<=
x
&&
x
<=
or_level
let
logic_level
=
77
(* Tif: 4 [%right QUESTION prec_question] *)
let
bitwiseLevel
=
75
(* 10 [%left BIFF]
let
bitwiseLevel
=
75
(* 10 [%left BIFF]
11 [%right BIMPLIES]
11 [%right BIMPLIES]
12 [%left PIPE]
12 [%left PIPE]
...
@@ -172,21 +181,14 @@ module Precedence = struct
...
@@ -172,21 +181,14 @@ module Precedence = struct
14 [%left STARHAT] (releted to \repeat)
14 [%left STARHAT] (releted to \repeat)
15 [%nonassoc IN] ???
15 [%nonassoc IN] ???
16 [%left AMP] *)
16 [%left AMP] *)
let
logic_level
=
77
(* Tif:
let
comparativeLevel
=
70
(* 17 [%left LT] *)
4 [%right QUESTION prec_question] *)
let
additiveLevel
=
60
(* 19 [%left PLUS MINUS] *)
let
multiplicativeLevel
=
40
(* 20 [%left STAR SLASH PERCENT] *)
(* Be careful if you change the relative order of these 3 levels *)
let
addrOfLevel
=
30
(* 21 [%right prec_cast TILDE NOT prec_unary_op] *)
let
and_level
=
83
(* 9 [%left AND] *)
let
derefStarLevel
=
20
(* 23 [%left DOT ARROW LSQUARE] *)
let
xor_level
=
84
(* 8 [%left HATHAT] *)
let
indexLevel
=
20
(* 23 [%left DOT ARROW LSQUARE] *)
let
or_level
=
85
(* 7 [%left OR] *)
let
arrowLevel
=
20
(* 23 [%left DOT ARROW LSQUARE] *)
let
assoc_connector_level
x
=
and_level
<=
x
&&
x
<=
or_level
let
binderLevel
=
90
(* 3 [%nonassoc prec_forall prec_exists prec_lambda LET] *)
let
questionLevel
=
100
(* Pif, Aquestion:
4 [%right QUESTION prec_question] *)
let
upperLevel
=
110
(* 2 [%nonassoc TYPENAME]
1 [%right prec_named] *)
(* is this predicate the encoding of [\in]? If so, return its arguments. *)
(* is this predicate the encoding of [\in]? If so, return its arguments. *)
let
subset_is_backslash_in
p
=
match
p
with
let
subset_is_backslash_in
p
=
match
p
with
...
@@ -209,21 +211,24 @@ module Precedence = struct
...
@@ -209,21 +211,24 @@ module Precedence = struct
|
Pseparated
_
|
Pseparated
_
|
Pat
_
|
Pat
_
|
Pfresh
_
->
0
|
Pfresh
_
->
0
|
Papp
_
as
p
->
if
subset_is_backslash_in
p
=
None
then
0
else
36
|
Pnot
_
->
30
(* 21 [%right prec_cast TILDE NOT prec_unary_op] *)
|
Psubtype
_
->
75
(* 22 [%nonassoc LTCOLON COLONGT] *)
|
Pand
_
->
and_level
(* 9 [%left AND] *)
|
Pxor
_
->
xor_level
(* 8 [%left HATHAT] *)
|
Por
_
->
or_level
(* 7 [%left OR] *)
|
Pimplies
_
->
87
(* and 88 for positive side *)
(* 4 [%right IMPLIES] *)
|
Piff
_
->
89
(* 5 [%left IFF] *)
|
Pif
_
->
questionLevel
(* 4 [%right QUESTION prec_question] *)
|
Prel
_
->
comparativeLevel
(* 18 [%left LT] *)
|
Plet
_
|
Plet
_
|
Pforall
_
|
Pforall
_
|
Pexists
_
->
binderLevel
(* 3 [%nonassoc prec_forall prec_exists prec_lambda LET] *)
|
Pexists
_
->
binderLevel
(* Occurence order in [logic_parser.mly]:
3 [%nonassoc prec_forall prec_exists prec_lambda LET] *)
|
Pif
_
->
questionLevel
(* 4 [%right QUESTION prec_question] *)
|
Piff
_
->
89
(* 5 [%left IFF] *)
|
Pimplies
_
->
87
(* and 88 for positive side *)
(* 6 [%right IMPLIES] *)
|
Por
_
->
or_level
(* 7 [%left OR] *)
|
Pxor
_
->
xor_level
(* 8 [%left HATHAT] *)
|
Pand
_
->
and_level
(* 9 [%left AND] *)
|
Papp
_
as
p
->
if
subset_is_backslash_in
p
=
None
then
0
else
36
(* 15 [%nonassoc IN] ??? *)
|
Prel
_
->
comparativeLevel
(* 18 [%left LT] *)
|
Pnot
_
->
30
(* 21 [%right prec_cast TILDE NOT prec_unary_op] *)
|
Psubtype
_
->
75
(* 22 [%nonassoc LTCOLON COLONGT] *)
let
compareLevel
x
y
=
let
compareLevel
x
y
=
if
assoc_connector_level
x
&&
assoc_connector_level
y
then
0
if
assoc_connector_level
x
&&
assoc_connector_level
y
then
0
...
...
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