Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
vite
Commits
9171a24c
Commit
9171a24c
authored
Feb 06, 2009
by
Pascal Noisette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Distinction lexical (TokenSource) et syntaxique (Line)
parent
63cb25dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
parser/src/Definition.cpp
parser/src/Definition.cpp
+4
-3
parser/src/ParserDefinitionDecoder.cpp
parser/src/ParserDefinitionDecoder.cpp
+14
-7
No files found.
parser/src/Definition.cpp
View file @
9171a24c
...
...
@@ -22,10 +22,11 @@ void Definition::store(std::string name, std::string value){
}
void
Definition
::
print
(){
cout
<<
"Name : "
<<
_event_name
<<
endl
;
cout
<<
" Fields :"
<<
endl
;
cout
<<
_event_name
<<
endl
;
for
(
unsigned
int
i
=
0
;
i
<
_fields
.
size
()
;
i
++
){
cout
<<
_fields
[
i
].
_name
<<
" |
"
<<
_fields
[
i
].
_type
<<
endl
;
cout
<<
" "
<<
_fields
[
i
].
_name
<<
"
"
<<
_fields
[
i
].
_type
<<
endl
;
}
cout
<<
"______"
<<
endl
;
}
parser/src/ParserDefinitionDecoder.cpp
View file @
9171a24c
...
...
@@ -10,9 +10,9 @@ int ParserDefinitionDecoder::definitions_number(){
void
ParserDefinitionDecoder
::
store_definition
(
Line
&
line
){
//read the definition header
string
&
definition_name
=
line
.
item
(
1
);
string
&
definition_name
=
line
.
item
(
2
);
const
char
*
definition_identity_string
=
line
.
item
(
2
).
c_str
();
const
char
*
definition_identity_string
=
line
.
item
(
3
).
c_str
();
int
definition_identity
=
atoi
(
definition_identity_string
);
...
...
@@ -24,11 +24,17 @@ void ParserDefinitionDecoder::store_definition(Line &line){
line
.
clear
();
//read and store the parameters list
string
final
=
"
%
EndEventDef"
;
string
final
=
"EndEventDef"
;
while
(
!
line
.
eof
()){
line
.
newline
();
if
(
line
.
starts_with
(
final
))
//std::cout << "line " << line.item(0)<< " " << line.item(1);
if
(
line
.
item
(
1
)
==
final
)
{
//std::cout << "end" <<endl;
break
;
}
else
;
//std::cout << "continue"<< endl;
if
(
line
.
length
()
!=
3
)
//verifier le % au lieu de tester le nombre de token
//ajouter un warning vers l'interface
...
...
@@ -40,7 +46,8 @@ void ParserDefinitionDecoder::store_definition(Line &line){
line
.
clear
();
}
line
.
clear
();
_definitions
.
insert
(
pair
<
int
,
Definition
>
(
definition_identity
,
current_definition
));
_definitions
.
insert
(
pair
<
int
,
Definition
>
(
definition_identity
,
current_definition
));
}
Definition
&
ParserDefinitionDecoder
::
get_definition
(
int
i
){
...
...
@@ -52,10 +59,10 @@ void ParserDefinitionDecoder::print_definitions(){
map
<
int
,
Definition
>::
iterator
it
;
for
(
it
=
_definitions
.
begin
();
it
!=
_definitions
.
end
()
;
++
it
){
// (*it).second represents the current definition
cout
<<
"
definition number = "
<<
(
*
it
).
first
<<
" :"
<<
endl
;
cout
<<
"
# "
<<
(
*
it
).
first
<<
endl
;
(
*
it
).
second
.
print
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment