Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lustre-v6
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
verimag
synchrone
lustre-v6
Commits
1aab41bf
Commit
1aab41bf
authored
16 years ago
by
Erwan Jahier
Browse files
Options
Downloads
Patches
Plain Diff
Add an include directive.
Also, in verbose mode, print the full path of the openned files.
parent
ea7cd07d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/lxm.ml
+7
-1
7 additions, 1 deletion
src/lxm.ml
src/lxm.mli
+3
-1
3 additions, 1 deletion
src/lxm.mli
src/main.ml
+37
-25
37 additions, 25 deletions
src/main.ml
src/parser.mly
+19
-6
19 additions, 6 deletions
src/parser.mly
src/syntaxTree.ml
+3
-3
3 additions, 3 deletions
src/syntaxTree.ml
with
69 additions
and
36 deletions
src/lxm.ml
+
7
−
1
View file @
1aab41bf
(** Time-stamp: <modified the
28
/05/2008 (at 1
4:09
) by Erwan Jahier> *)
(** Time-stamp: <modified the
30
/05/2008 (at 1
5:42
) by Erwan Jahier> *)
(** Common to lus2lic and lic2loc *)
(** Common to lus2lic and lic2loc *)
...
@@ -78,4 +78,10 @@ let make ( lexbuf ) = (
...
@@ -78,4 +78,10 @@ let make ( lexbuf ) = (
)
)
let
make_string
(
lexbuf
)
=
let
lxm
=
make
lexbuf
in
{
lxm
with
_str
=
String
.
sub
lxm
._
str
1
((
String
.
length
lxm
._
str
)
-
2
)
}
let
last_made
()
=
!
last_lexeme
let
last_made
()
=
!
last_lexeme
This diff is collapsed.
Click to expand it.
src/lxm.mli
+
3
−
1
View file @
1aab41bf
(** Time-stamp: <modified the
14
/0
4
/2008 (at 1
7:53
) by Erwan Jahier> *)
(** Time-stamp: <modified the
30
/0
5
/2008 (at 1
5:42
) by Erwan Jahier> *)
(** Common to lus2lic and lic2loc *)
(** Common to lus2lic and lic2loc *)
...
@@ -28,6 +28,8 @@ val cend : t -> int
...
@@ -28,6 +28,8 @@ val cend : t -> int
val
make
:
Lexing
.
lexbuf
->
t
val
make
:
Lexing
.
lexbuf
->
t
val
new_line
:
Lexing
.
lexbuf
->
unit
val
new_line
:
Lexing
.
lexbuf
->
unit
(* remove the quotes from the string *)
val
make_string
:
Lexing
.
lexbuf
->
t
(** compiler interface *)
(** compiler interface *)
...
...
This diff is collapsed.
Click to expand it.
src/main.ml
+
37
−
25
View file @
1aab41bf
(** Time-stamp: <modified the
28
/05/2008 (at 1
4
:3
0
) by Erwan Jahier> *)
(** Time-stamp: <modified the
30
/05/2008 (at 1
5
:3
7
) by Erwan Jahier> *)
(** Here follows a description of the different modules used by this lus2lic compiler.
(** Here follows a description of the different modules used by this lus2lic compiler.
...
@@ -159,15 +159,16 @@ type maybe_packed =
...
@@ -159,15 +159,16 @@ type maybe_packed =
let
(
get_source_list
:
string
list
->
SyntaxTree
.
pack_or_model
list
)
=
let
(
get_source_list
:
string
list
->
SyntaxTree
.
pack_or_model
list
)
=
fun
infile_list
->
fun
infile_list
->
let
(
get_one_source
:
string
->
maybe_packed
)
=
let
(
get_one_source
:
string
->
string
list
*
maybe_packed
)
=
fun
infile
->
fun
infile
->
let
inchannel
=
open_in
infile
in
let
inchannel
=
Verbose
.
print_string
~
level
:
3
(
"Opening file "
^
(
Sys
.
getcwd
()
)
^
infile
^
"
\n
"
);
open_in
infile
in
let
lexbuf
=
Lexing
.
from_channel
inchannel
in
let
lexbuf
=
Lexing
.
from_channel
inchannel
in
Verbose
.
print_string
~
level
:
3
(
"Opening file "
^
infile
^
"
\n
"
);
Global
.
vars
.
current_file
<-
infile
;
Global
.
vars
.
current_file
<-
infile
;
match
(
lus_load
lexbuf
)
with
match
(
lus_load
lexbuf
)
with
|
PRPackBody
pbdy
->
|
PRPackBody
(
incl_files
,
pbdy
)
->
let
nme
=
let
nme
=
try
Filename
.
chop_extension
(
Filename
.
basename
infile
)
try
Filename
.
chop_extension
(
Filename
.
basename
infile
)
with
_
->
print_string
(
"*** '"
^
infile
^
"': Bad file name
\n
"
);
exit
1
with
_
->
print_string
(
"*** '"
^
infile
^
"': Bad file name
\n
"
);
exit
1
...
@@ -175,27 +176,38 @@ let (get_source_list : string list -> SyntaxTree.pack_or_model list) =
...
@@ -175,27 +176,38 @@ let (get_source_list : string list -> SyntaxTree.pack_or_model list) =
let
pi
=
let
pi
=
SyntaxTree
.
give_pack_this_name
(
Ident
.
pack_name_of_string
nme
)
pbdy
SyntaxTree
.
give_pack_this_name
(
Ident
.
pack_name_of_string
nme
)
pbdy
in
in
Unpacked
(
NSPack
(
Lxm
.
flagit
pi
(
Lxm
.
dummy
nme
)))
incl_files
,
Unpacked
(
NSPack
(
Lxm
.
flagit
pi
(
Lxm
.
dummy
nme
)))
|
PRPack_or_models
nsl
->
Packed
nsl
|
PRPack_or_models
(
incl_files
,
nsl
)
->
incl_files
,
Packed
nsl
in
in
let
(
get_remaining_source_list
:
maybe_packed
->
string
->
maybe_packed
)
=
let
rec
(
get_remaining_source_list
:
maybe_packed
*
string
list
*
string
list
->
fun
acc
infile
->
maybe_packed
*
string
list
*
string
list
)
=
match
acc
,
get_one_source
infile
with
fun
(
maybe_pack
,
compiled
,
to_be_compiled
)
->
|
Unpacked
_
,
_
match
to_be_compiled
with
|
_
,
Unpacked
_
->
|
[]
->
(
maybe_pack
,
compiled
,
[]
)
print_string
(
"old-style (un-packaged) lustre files can "
^
|
infile
::
tail
->
" not be mixed with packages, nor be "
^
if
List
.
mem
infile
compiled
then
" defined in more than 1 file."
);
get_remaining_source_list
(
maybe_pack
,
compiled
,
tail
)
exit
1
else
|
Packed
l1
,
Packed
l2
->
Packed
(
l1
@
l2
)
let
included_files
,
pack
=
get_one_source
infile
in
let
new_maybe_pack
=
match
maybe_pack
,
pack
with
|
Unpacked
_
,
_
|
_
,
Unpacked
_
->
print_string
(
"old-style (un-packaged) lustre files can "
^
" not be mixed with packages, nor be "
^
" defined in more than 1 file."
);
exit
1
|
Packed
l1
,
Packed
l2
->
Packed
(
l1
@
l2
)
in
get_remaining_source_list
(
new_maybe_pack
,
infile
::
compiled
,
tail
@
included_files
)
in
in
let
pack_list
=
let
first_file
=
assert
(
infile_list
<>
[]
);
List
.
hd
infile_list
in
assert
(
infile_list
<>
[]
);
let
included_files
,
first_pack
=
get_one_source
first_file
in
List
.
fold_left
let
(
pack_list
,_,_
)
=
get_remaining_source_list
get_remaining_source_list
(
first_pack
,
[
first_file
]
,
(
List
.
tl
infile_list
)
@
included_files
)
(
get_one_source
(
List
.
hd
infile_list
))
(
List
.
tl
infile_list
)
in
in
match
pack_list
with
match
pack_list
with
|
Packed
l
->
l
|
Packed
l
->
l
...
...
This diff is collapsed.
Click to expand it.
src/parser.mly
+
19
−
6
View file @
1aab41bf
...
@@ -306,7 +306,6 @@ let (treat_external_node : bool -> Lxm.t ->
...
@@ -306,7 +306,6 @@ let (treat_external_node : bool -> Lxm.t ->
add_info
node_table
"(extern) node"
ext_nodelxm
ninfo
;
add_info
node_table
"(extern) node"
ext_nodelxm
ninfo
;
def_list
:=
(
NodeItem
(
Lxm
.
id
(
ext_nodelxm
)
,
statics
))
::
!
def_list
def_list
:=
(
NodeItem
(
Lxm
.
id
(
ext_nodelxm
)
,
statics
))
::
!
def_list
(**********************************************************************************)
(**********************************************************************************)
(**********************************************************************************)
(**********************************************************************************)
(**********************************************************************************)
(**********************************************************************************)
...
@@ -395,6 +394,9 @@ let (treat_external_node : bool -> Lxm.t ->
...
@@ -395,6 +394,9 @@ let (treat_external_node : bool -> Lxm.t ->
%
token
<
Lxm
.
t
>
TK_IS
%
token
<
Lxm
.
t
>
TK_IS
%
token
<
Lxm
.
t
>
TK_BODY
%
token
<
Lxm
.
t
>
TK_BODY
%
token
<
Lxm
.
t
>
TK_END
%
token
<
Lxm
.
t
>
TK_END
%
token
<
Lxm
.
t
>
TK_INCLUDE
%
token
<
Lxm
.
t
>
TK_STRING
/*
%
token
<
Lxm
.
t
>
TK_QUOTE
*/
/*
Priorities
*/
/*
Priorities
*/
...
@@ -448,13 +450,13 @@ or a list of pack/model declaration
...
@@ -448,13 +450,13 @@ or a list of pack/model declaration
sxLusFile
:
sxLusFile
:
/*
WARNING
!
il
faut
remettre
la
liste
l'endroit
*/
/*
WARNING
!
il
faut
remettre
la
liste
l'endroit
*/
sxPackBody
TK_EOF
sxIncludeList
sxPackBody
TK_EOF
{
{
SyntaxTree
.
PRPackBody
$
1
SyntaxTree
.
PRPackBody
(
$
1
,
$
2
)
}
}
|
sxPackList
TK_EOF
|
sxIncludeList
sxPackList
TK_EOF
{
{
SyntaxTree
.
PRPack_or_models
(
List
.
rev
$
1
)
SyntaxTree
.
PRPack_or_models
(
$
1
,
List
.
rev
$
2
)
}
}
;
;
...
@@ -474,9 +476,20 @@ sxOnePack:
...
@@ -474,9 +476,20 @@ sxOnePack:
{
SyntaxTree
.
NSPack
$
1
}
{
SyntaxTree
.
NSPack
$
1
}
;
;
sxInclude
:
TK_INCLUDE
TK_STRING
{
(
Lxm
.
str
$
2
)
}
;
sxIncludeList
:
{
[]
}
|
sxInclude
sxIncludeList
{
$
1
::$
2
}
;
/*
/*
Pour
les
provides
,
on
rend
des
decls
,
bien
Pour
les
provides
,
on
rend
des
decls
,
bien
que
syn
a
taxiquement
,
on
n'autorise
pas
n'importe
quoi
...
que
syntaxiquement
,
on
n'autorise
pas
n'importe
quoi
...
*/
*/
sxProvides
:
sxProvides
:
...
...
This diff is collapsed.
Click to expand it.
src/syntaxTree.ml
+
3
−
3
View file @
1aab41bf
(** Time-stamp: <modified the
1
0/0
3
/2008 (at 1
1:07
) by Erwan Jahier> *)
(** Time-stamp: <modified the
3
0/0
5
/2008 (at 1
0:26
) by Erwan Jahier> *)
(** (Raw) Abstract syntax tree of source programs.
(** (Raw) Abstract syntax tree of source programs.
...
@@ -23,8 +23,8 @@ type 'a error =
...
@@ -23,8 +23,8 @@ type 'a error =
(**********************************************************************************)
(**********************************************************************************)
type
t
=
type
t
=
PRPackBody
of
packbody
PRPackBody
of
string
list
*
packbody
|
PRPack_or_models
of
pack_or_model
list
|
PRPack_or_models
of
string
list
*
pack_or_model
list
and
and
pack_or_model
=
pack_or_model
=
NSPack
of
pack_info
srcflagged
NSPack
of
pack_info
srcflagged
...
...
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