Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xcap-capability-linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xcap
xcap-capability-linux
Commits
61d2a707
Commit
61d2a707
authored
Nov 05, 2014
by
Sarah Spall
Committed by
Vikram Narayanan
Oct 25, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing lots of c++ bugs, still undefined reference to static class variable
parent
428543c4
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
240 additions
and
5040 deletions
+240
-5040
tools/lcd/idl/Makefile
tools/lcd/idl/Makefile
+10
-5
tools/lcd/idl/ast/lcd_ast.cpp
tools/lcd/idl/ast/lcd_ast.cpp
+85
-20
tools/lcd/idl/ast/scope.cpp
tools/lcd/idl/ast/scope.cpp
+70
-10
tools/lcd/idl/include/lcd_ast.h
tools/lcd/idl/include/lcd_ast.h
+52
-50
tools/lcd/idl/include/scope.h
tools/lcd/idl/include/scope.h
+0
-15
tools/lcd/idl/parser/lcd_idl.cpp
tools/lcd/idl/parser/lcd_idl.cpp
+0
-4876
tools/lcd/idl/parser/lcd_idl.peg
tools/lcd/idl/parser/lcd_idl.peg
+23
-64
No files found.
tools/lcd/idl/Makefile
View file @
61d2a707
lcd_compiler
:
lcd_ast.o lcd_compiler.o lcd_idl.o
g++ lcd_idl.o lcd_ast.o lcd_compiler.o
-o
compiler
lcd_compiler
:
lcd_ast.o lcd_compiler.o lcd_idl.o
scope.o
g++ lcd_idl.o lcd_ast.o
scope.o
lcd_compiler.o
-o
compiler
lcd_compiler.o
:
lcd_compiler.cpp include/lcd_ast.h lcd_idl.h
g++
-c
-g
lcd_compiler.cpp
lcd_idl.o
:
parser/lcd_idl.h include/lcd_ast.h
lcd_idl.o
:
lcd_idl.h include/lcd_ast.h lcd_idl.cpp
g++
-c
parser/lcd_idl.cpp
lcd_ast.o
:
include/lcd_ast.h
scope.o
:
include/lcd_ast.h ast/scope.cpp
g++
-c
ast/scope.cpp include/lcd_ast.h
lcd_ast.o
:
include/lcd_ast.h ast/lcd_ast.cpp
g++
-c
ast/lcd_ast.cpp include/lcd_ast.h
lcd_idl.h
:
parser/vembyr-1.1/peg.py
--h
parser/lcd_idl.peg
>
parser/lcd_idl.h
...
...
@@ -16,7 +21,7 @@ lcd_idl.cpp:
parser/vembyr-1.1/peg.py
--cpp
parser/lcd_idl.peg
>
parser/lcd_idl.cpp
clean
:
rm
lcd_idl.cpp
lcd_idl.h lcd_ast.h.gch compiler
*
.o
rm
parser/lcd_idl.cpp parser/
lcd_idl.h lcd_ast.h.gch compiler
*
.o
test
:
lcd_compiler
./test/test.py
tools/lcd/idl/ast/lcd_ast.cpp
View file @
61d2a707
#include "lcd_ast.h"
Scope
::
Scope
()
{
// init builtin int types
builtin
=
new
map
<
PrimType
,
Type
>
();
// instert for each builtin in type, add size to type if not done alreayd
builtin
->
insert
(
std
::
pair
<
int
,
Type
>
(
1
,
new
IntegerType
(
kChar
,
false
,
sizeof
(
"char"
))));
builtin
->
insert
(
std
::
pair
<
int
,
Type
>
(
1
,
new
IntegerType
(
kChar
,
true
,
sizeof
(
"char"
))));
builtin
->
insert
(
std
::
pair
<
int
,
Type
>
(
1
,
new
IntegerType
(
kShort
,
false
,
sizeof
(
"short"
))));
builtin
->
insert
(
std
::
pair
<
int
,
Type
>
(
1
,
new
IntegerType
(
kShort
,
true
,
sizeof
(
"short"
))));
builtin
->
insert
(
std
::
pair
<
int
,
Type
>
(
1
,
new
IntegerType
(
kInt
,
false
,
sizeof
(
"int"
))));
builtin
->
insert
(
std
::
pair
<
int
,
Type
>
(
1
,
new
IntegerType
(
kInt
,
true
,
sizeof
(
"int"
))));
builtin
->
insert
(
std
::
pair
<
int
,
Type
>
(
1
,
new
IntegerType
(
kLong
,
false
,
sizeof
(
"long"
))));
builtin
->
insert
(
std
::
pair
<
int
,
Type
>
(
1
,
new
IntegerType
(
kLong
,
true
,
sizeof
(
"long"
))));
builtin
->
insert
(
std
::
pair
<
int
,
Type
>
(
1
,
new
IntegerType
(
kLongLong
,
false
,
sizeof
(
"long long"
))));
builtin
->
insert
(
std
::
pair
<
int
,
Type
>
(
1
,
new
IntegerType
(
kLongLong
,
true
,
sizeof
(
"long long"
))));
builtin
->
insert
(
std
::
pair
<
int
,
Type
>
(
1
,
new
IntegerType
(
kCapability
,
false
,
sizeof
(
"int"
))));
#include "../include/lcd_ast.h"
Typedef
::
Typedef
(
const
char
*
alias
,
Type
*
type
)
{
this
->
alias_
=
alias
;
this
->
type_
=
type
;
// need to allocate?
}
void
Typedef
::
accept
(
ASTVisitor
*
worker
)
...
...
@@ -23,34 +11,111 @@ void Typedef::accept(ASTVisitor* worker)
worker
->
visit
(
this
);
}
IntegerType
::
IntegerType
(
const
char
*
type
,
bool
un
,
int
size
)
{
this
->
type_
=
type
;
this
->
unsigned_
=
un
;
this
->
size_
=
size
;
}
void
IntegerType
::
accept
(
ASTVisitor
*
worker
)
{
worker
->
visit
(
this
);
}
PointerType
::
PointerType
(
Type
*
type
)
{
this
->
type_
=
type
;
}
void
PointerType
::
accept
(
ASTVisitor
*
worker
)
{
worker
->
visit
(
this
);
}
ProjectionField
::
ProjectionField
(
bool
in
,
bool
out
,
bool
alloc
,
bool
bind
,
Type
*
field_type
,
const
char
*
field_name
)
{
this
->
in_
=
in
;
this
->
out_
=
out
;
this
->
alloc_
=
alloc
;
this
->
bind_
=
bind
;
this
->
field_type_
=
field_type
;
this
->
field_name_
=
field_name
;
}
bool
ProjectionField
::
in
()
{
return
this
->
in_
;
}
bool
ProjectionField
::
out
()
{
return
this
->
out_
;
}
bool
ProjectionField
::
alloc
()
{
return
this
->
alloc_
;
}
bool
ProjectionField
::
bind
()
{
return
this
->
bind_
;
}
void
ProjectionField
::
accept
(
ASTVisitor
*
worker
)
{
worker
->
visit
(
this
);
}
ProjectionType
::
ProjectionType
(
const
char
*
id
,
const
char
*
real_type
,
std
::
vector
<
ProjectionField
*>*
fields
)
{
this
->
id_
=
id
;
this
->
real_type_
=
real_type
;
this
->
fields_
=
fields
;
}
void
ProjectionType
::
accept
(
ASTVisitor
*
worker
)
{
worker
->
visit
(
this
);
}
Parameter
::
Parameter
(
Type
*
type
,
const
char
*
name
)
{
this
->
type_
=
type
;
this
->
name_
=
name
;
}
void
Parameter
::
accept
(
ASTVisitor
*
worker
)
{
worker
->
visit
(
this
);
}
Rpc
::
Rpc
(
Type
*
return_type
,
const
char
*
name
,
std
::
vector
<
Parameter
*
>*
parameters
)
{
this
->
ret_type_
=
return_type
;
this
->
name_
=
name
;
this
->
params_
=
parameters
;
}
const
char
*
Rpc
::
name
()
{
return
name_
;
}
Type
*
Rpc
::
return_type
()
{
return
ret_type_
;
}
void
Rpc
::
accept
(
ASTVisitor
*
worker
)
{
worker
->
visit
(
this
);
}
void
ProjectionField
::
accept
(
ASTVisitor
*
worker
)
std
::
vector
<
Parameter
*>*
Rpc
::
parameters
(
)
{
worker
->
visit
(
this
);
return
params_
;
}
File
::
File
(
const
char
*
verbatim
,
FileScope
*
fs
,
std
::
vector
<
Rpc
*
>*
rpc_definitions
)
{
this
->
verbatim_
=
verbatim
;
this
->
scope_
=
fs
;
this
->
rpc_defs_
=
rpc_definitions
;
}
void
File
::
accept
(
ASTVisitor
*
worker
)
...
...
tools/lcd/idl/ast/scope.cpp
View file @
61d2a707
#include "
include/scope
.h"
#include "
../include/lcd_ast
.h"
static
Root_scope
*
Root_scope
::
instanc
e
()
RootScope
::
RootScop
e
()
{
if
(
!
instance_
)
instance_
=
new
Root_scope
();
// init builtin int types
this
->
types_
=
new
std
::
map
<
const
char
*
,
Type
*>
();
// instert for each builtin in type, add size to type if not done alreayd
this
->
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
"char"
,
new
IntegerType
(
"char"
,
false
,
sizeof
(
"char"
))));
this
->
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
"unsigned char"
,
new
IntegerType
(
"unsigned char"
,
true
,
sizeof
(
"char"
))));
this
->
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
"short"
,
new
IntegerType
(
"short"
,
false
,
sizeof
(
"short"
))));
this
->
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
"unsigned short"
,
new
IntegerType
(
"unsigned short"
,
true
,
sizeof
(
"short"
))));
this
->
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
"int"
,
new
IntegerType
(
"int"
,
false
,
sizeof
(
"int"
))));
this
->
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
"unsigned int"
,
new
IntegerType
(
"unsigned int"
,
true
,
sizeof
(
"int"
))));
this
->
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
"long"
,
new
IntegerType
(
"long"
,
false
,
sizeof
(
"long"
))));
this
->
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
"unsigned long"
,
new
IntegerType
(
"unsigned long"
,
true
,
sizeof
(
"long"
))));
this
->
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
"long long"
,
new
IntegerType
(
"long long"
,
false
,
sizeof
(
"long long"
))));
this
->
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
"unsigned long long"
,
new
IntegerType
(
"unsigned long long"
,
true
,
sizeof
(
"long long"
))));
this
->
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
"capability"
,
new
IntegerType
(
"capability_t"
,
false
,
sizeof
(
"int"
))));
}
RootScope
*
RootScope
::
instance
()
{
if
(
!
RootScope
::
instance_
)
RootScope
::
instance_
=
new
RootScope
();
return
instance_
;
}
Type
*
Root
_scope
::
lookup_symbol
(
char
*
sym
,
int
*
err
)
Type
*
Root
Scope
::
lookup_symbol
(
const
char
*
sym
,
int
*
err
)
{
if
(
types_
.
find
(
sym
)
==
types_
.
end
())
if
(
types_
->
find
(
sym
)
==
types_
->
end
())
{
// error
}
else
return
types_
[
sym
];
return
(
*
types_
)
[
sym
];
}
int
Root
_scope
::
insert_symbol
(
char
*
sym
,
Type
*
value
)
int
Root
Scope
::
insert_symbol
(
const
char
*
sym
,
Type
*
value
)
{
std
::
pair
<
std
::
map
<
char
*
,
Type
*>::
iterator
,
bool
>
ret
;
ret
=
types_
.
insert
(
std
::
pair
<
char
*
,
Type
*>
(
sym
,
value
));
std
::
pair
<
std
::
map
<
c
onst
c
har
*
,
Type
*>::
iterator
,
bool
>
ret
;
ret
=
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
sym
,
value
));
return
ret
.
second
;
}
// file scope
Type
*
FileScope
::
lookup_symbol
(
const
char
*
sym
,
int
*
err
)
{
// lookup here or root first?
if
(
types_
->
find
(
sym
)
==
types_
->
end
())
{
// error
}
else
return
(
*
types_
)[
sym
];
}
int
FileScope
::
insert_symbol
(
const
char
*
sym
,
Type
*
value
)
{
// redefinition of something at root scope?
std
::
pair
<
std
::
map
<
const
char
*
,
Type
*>::
iterator
,
bool
>
ret
;
ret
=
types_
->
insert
(
std
::
pair
<
const
char
*
,
Type
*>
(
sym
,
value
));
return
ret
.
second
;
}
FileScope
::
FileScope
(
RootScope
*
root
)
{
this
->
root_
=
root
;
this
->
types_
=
new
std
::
map
<
const
char
*
,
Type
*>
();
}
tools/lcd/idl/include/lcd_ast.h
View file @
61d2a707
...
...
@@ -17,50 +17,63 @@ class Type : public Base
{
public:
virtual
void
accept
(
ASTVisitor
*
worker
)
=
0
;
virtual
void
marshal
()
=
0
;
virtual
int
size
()
=
0
;
//
virtual void marshal() = 0;
//
virtual int size() = 0;
};
class
Scope
:
public
Base
{
// add built in types here, so size can be evaluated before parse
private:
std
::
map
<
int
,
Type
>
types_
;
void
init_types
();
public:
Scope
()
;
Type
*
lookup_symbol
(
char
*
sym
)
;
virtual
Type
*
lookup_symbol
(
const
char
*
sym
,
int
*
err
)
=
0
;
virtual
int
insert_symbol
(
const
char
*
sym
,
Type
*
type
)
=
0
;
};
class
RootScope
:
public
Scope
{
static
RootScope
*
instance_
;
std
::
map
<
const
char
*
,
Type
*>*
types_
;
void
init_types
();
RootScope
(
void
);
public:
RootScope
();
static
int
test
();
static
RootScope
*
instance
();
virtual
Type
*
lookup_symbol
(
const
char
*
sym
,
int
*
err
);
virtual
int
insert_symbol
(
const
char
*
sym
,
Type
*
type
);
};
class
FileScope
:
public
Scope
{
RootScope
*
root_
;
std
::
map
<
const
char
*
,
Type
*>
*
types_
;
public:
FileScope
(
RootScope
*
root
);
virtual
Type
*
lookup_symbol
(
const
char
*
sym
,
int
*
err
);
virtual
int
insert_symbol
(
const
char
*
type
,
Type
*
t
);
};
class
Typedef
:
public
Type
{
Type
*
type_
;
char
*
alias_
;
c
onst
c
har
*
alias_
;
char
*
marshal_info_
;
public:
Typedef
(
const
char
*
alias
,
Type
*
type
);
virtual
void
accept
(
ASTVisitor
*
worker
);
virtual
void
marshal
();
//
virtual void marshal();
};
class
IntegerType
:
public
Type
{
bool
unsigned_
;
PrimType
type_
;
const
char
*
type_
;
int
size_
;
public:
IntegerType
(
PrimType
type
,
bool
un
,
int
size
)
{
this
->
unsigned_
=
un
;
this
->
type_
=
type
;
this
->
size_
=
size
;}
IntegerType
(
const
char
*
type
,
bool
un
,
int
size
);
virtual
void
accept
(
ASTVisitor
*
worker
);
virtual
void
marshal
();
//
virtual void marshal();
};
class
CapabilityType
:
public
IntegerType
...
...
@@ -74,7 +87,7 @@ class PointerType : public Type
public:
PointerType
(
Type
*
type
);
virtual
void
accept
(
ASTVisitor
*
worker
);
virtual
void
marshal
();
//
virtual void marshal();
};
class
ProjectionField
:
public
Base
...
...
@@ -84,41 +97,37 @@ class ProjectionField : public Base
bool
alloc_
;
bool
bind_
;
Type
*
field_type_
;
char
*
field_name_
;
c
onst
c
har
*
field_name_
;
public:
ProjectionField
(
bool
in
,
bool
out
,
bool
alloc
,
bool
bind
,
Type
*
field_type
,
char
*
field_name
)
{
this
->
in_
=
in
;
this
->
out_
=
out
;
this
->
alloc_
=
alloc
;
this
->
bind_
=
bind
;
this
->
field_type_
=
field_type
;
this
->
field_name_
=
field_name
;
}
ProjectionField
(
bool
in
,
bool
out
,
bool
alloc
,
bool
bind
,
Type
*
field_type
,
const
char
*
field_name
);
~
ProjectionField
();
bool
in
()
{
return
in_
;
}
bool
out
()
{
return
out_
;
}
bool
alloc
()
{
return
alloc_
;
}
bool
bind
()
{
return
bind_
;
}
bool
in
()
;
bool
out
()
;
bool
alloc
()
;
bool
bind
()
;
void
accept
(
ASTVisitor
*
worker
);
};
class
ProjectionType
:
public
Type
// complex type
{
char
*
id_
;
char
*
real_type_
;
c
onst
c
har
*
id_
;
c
onst
c
har
*
real_type_
;
std
::
vector
<
ProjectionField
*>*
fields_
;
public:
ProjectionType
(
char
*
id
,
char
*
real_type
,
std
::
vector
<
ProjectionField
*>*
fields
)
{
this
->
id_
=
id
;
this
->
real_type_
=
real_type
;
this
->
fields_
=
fields
;
}
ProjectionType
(
const
char
*
id
,
const
char
*
real_type
,
std
::
vector
<
ProjectionField
*>*
fields
);
void
accept
(
ASTVisitor
*
worker
);
virtual
void
marshal
();
//
virtual void marshal();
};
class
Parameter
:
public
Base
{
Type
*
type_
;
char
*
name_
;
c
onst
c
har
*
name_
;
//M_info m;
public:
Parameter
(
Type
*
type
,
char
*
name
)
{
this
->
type_
=
type
;
this
->
name_
=
name
;
}
//m = new M_info(); }
Parameter
(
Type
*
type
,
const
char
*
name
);
~
Parameter
();
void
accept
(
ASTVisitor
*
worker
);
};
...
...
@@ -126,17 +135,14 @@ class Parameter : public Base
class
Rpc
:
public
Base
{
Type
*
ret_type_
;
char
*
name_
;
c
onst
c
har
*
name_
;
std
::
vector
<
Parameter
*
>*
params_
;
public:
Rpc
(
Type
*
return_type
,
char
*
name
,
std
::
vector
<
Parameter
*
>*
parameters
)
{
this
->
ret_type_
=
return_type
;
this
->
name_
=
name
;
this
->
params_
=
parameters
;
}
char
*
name
()
{
return
name_
;
}
Type
*
return_type
()
{
return
ret_type_
;
}
std
::
vector
<
Parameter
*>*
parameters
()
{
return
params_
;
}
Rpc
(
Type
*
return_type
,
const
char
*
name
,
std
::
vector
<
Parameter
*
>*
parameters
);
const
char
*
name
();
Type
*
return_type
();
std
::
vector
<
Parameter
*>*
parameters
();
void
accept
(
ASTVisitor
*
worker
);
};
...
...
@@ -170,19 +176,15 @@ class Message : public Definition
*/
class
File
:
public
Scop
e
class
File
:
public
Bas
e
{
char
*
verbatim_
;
RootScope
*
root_scope_
;
c
onst
c
har
*
verbatim_
;
FileScope
*
scope_
;
// has pointer to root scope
std
::
vector
<
Rpc
*>*
rpc_defs_
;
// std::vector<Message *>* message_defs_;
public:
File
(
char
*
verbatim
,
RootScope
*
rs
,
std
::
vector
<
Rpc
*
>*
rpc_definitions
)
{
this
->
verbatim_
=
verbatim
;
this
->
root_scope_
=
rs
;
this
->
rpc_defs_
=
rpc_definitions
;
}
File
(
const
char
*
verbatim
,
FileScope
*
fs
,
std
::
vector
<
Rpc
*
>*
rpc_definitions
);
void
accept
(
ASTVisitor
*
worker
);
};
...
...
tools/lcd/idl/include/scope.h
deleted
100644 → 0
View file @
428543c4
#ifndef SCOPE_H
#define SCOPE_H
#include "lcd_ast.h"
class
Root_scope
:
public
Scope
{
static
Root_scope
*
instance_
;
Root_scope
();
public:
static
Root_scope
*
instance
();
something
lookup_symbol
(
char
*
type
);
something
insert_symbol
(
char
*
type
,
value
);
}
#endif
tools/lcd/idl/parser/lcd_idl.cpp
deleted
100644 → 0
View file @
428543c4
This diff is collapsed.
Click to expand it.
tools/lcd/idl/parser/lcd_idl.peg
View file @
61d2a707
start-symbol: File
options: debug9
include: {{ #include "lcd_ast.h"
#include "scope.h"
include: {{ #include "../include/lcd_ast.h"
#include <vector>
#include <stdlib.h>
#include <string>
#include <stdint.h> }}
code: {{
Type * getType(char * type)
static FileScope* fs_instance;
FileScope* current_file_scope()
{
if(!fs_instance)
{
fs_instance = new FileScope(RootScope::instance());
}
return fs_instance;
}
Type * getType(const char* type)
{
int * err;
Root
_scope* rs = Root_s
cope::instance();
Type* val = rs->lookup_symbol(type, err)
:
Root
Scope* rs = RootS
cope::instance();
Type* val = rs->lookup_symbol(type, err)
;
if(!*err)
{ // error do something
}
...
...
@@ -22,11 +30,11 @@ code: {{
void insertType(char * sym, Type * val) // should this be void?
{
Root_scope *rs = Root_scope::instanc
e();
int ret =
r
s->insert_symbol(sym, val);
FileScope *fs = current_file_scop
e();
int ret =
f
s->insert_symbol(sym, val);
if(!ret)
{ // error do something
}
}
}
}}
...
...
@@ -50,55 +58,19 @@ IdentStart = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
IdentCont = IdentStart | [0123456789]
File = Spacing v:Verbatim? t:Things* <eof> {{
std::vector<Definition *>* defs = new std::vector<Definition *>;
File = Spacing v:Verbatim? t:Things* <eof> {{
std::vector<Rpc *>* rpcs = new std::vector<Rpc *>;
std::vector<Message *>* messages = new std::vector<Message *>;
std::map<char *, Definition*> *env = new std::map<char *, Definition *>;
for(Value::iterator it = t.getValues().begin(); it != t.getValues().end(); it ++)
{
const Value & v = *it;
Definition * ds = (Definition *) v.getValue();
if(!ds)
{
printf("error null pointer\n");
exit(0);
}
switch (ds->get_definition_type())
{
case kRpc:
{
Rpc * rp = reinterpret_cast<Rpc *>(ds);
Rpc * rp = (Rpc *) v.getValue();
rpcs->push_back(rp);
}
break;
case kMessage:
{
Message * mess = reinterpret_cast<Message *>(ds);
messages->push_back(mess);
}
break;
case kProjection:
{
Projection* proj = reinterpret_cast<Projection *>(ds);
env->insert(std::pair<char *, Definition *>(proj->name(), ds));
}
case kTypedef:
{
Typedef* td = reinterpret_cast<Typedef*>(ds);
env->insert(std::pair<char*, Definition*>(td->name(), ds));
}
break;
default:
{
printf("fatal error\n");
}
}
}
value = new File((char*) v.getValue(),
Root_scope::instance(), rpcs, message
s); }}
value = new File((char*) v.getValue(),
current_file_scope(), rpc
s); }}
Typedef = "typedef" Spacing "<" Spacing rt:RealType Spacing "," Spacing mt:Type Spacing ">" Spacing id:Identifier Spacing {{
Typedef * val = new Typedef((char*) rt.getValue(), (Type*) mt.getValue()
, (char*) id.getValue()
);
Typedef = "typedef" Spacing "<" Spacing rt:RealType Spacing "," Spacing mt:Type
_form
Spacing ">" Spacing id:Identifier Spacing {{
Typedef * val = new Typedef((char*) rt.getValue(), (Type*) mt.getValue());
insertType((char*)id.getValue(),val);
}}
...
...
@@ -157,7 +129,7 @@ String = <ascii 34> l:any_letter+ <ascii 34> {{
any_letter = [_.,/?<>'; =:%`!@#$^&*()-+{}|\\ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]
Things = Typedef | Rpc |
Message |
Projection
Things = Typedef | Rpc | Projection
Include = "#include" Space+ "<" Spacing f:Identifier Spacing ">" Spacing {{
std::ostringstream total;
...
...
@@ -193,17 +165,7 @@ Rpc = "rpc" Space+ t:Type_form id:Identifier Spacing OPEN p:Parameters CLOSE SE
value = new Rpc((Type *) t.getValue(), (char *) id.getValue(), (std::vector<Parameter *> *) p.getValue()); }}
Message = "message" Space+ id:Identifier Spacing OPENC Spacing m:Message_field* CLOSEC Spacing {{ std::vector<MessageField* >* fields = new std::vector<MessageField* >;
for(Value::iterator it = m.getValues().begin(); it != m.getValues().end(); it ++)
{
const Value & v = *it;
MessageField* mess_field = (MessageField *) v.getValue();
fields->push_back(mess_field);
}
value = new Message((char *) id.getValue(), fields); }}
Message_field = t:Type_form Space+ id:Identifier Spacing SEMI Spacing {{
value = new MessageField((Type* ) t.getValue(), (char* ) id.getValue()); }}
Projection = "projection" Space+ id:Identifier "<" Spacing t:Proj_type ">" Spacing OPENC Spacing p:ProjField+ CLOSEC Spacing {{ std::vector<ProjectionField *>* p_fields = new std::vector<ProjectionField *>;
for(Value::iterator it = p.getValues().begin(); it != p.getValues().end(); it ++)
...
...
@@ -213,9 +175,8 @@ Projection = "projection" Space+ id:Identifier "<" Spacing t:Proj_type ">" Spaci
p_fields->push_back(p);
}
// insert projection into rootscope for now
Project
* val = new Projection
((char* ) id.getValue(), (char* ) t.getValue(), p_fields);
Project
ionType * val = new ProjectionType
((char* ) id.getValue(), (char* ) t.getValue(), p_fields);
insertType((char*)id.getValue(), val);
value = val;
}}
## what is the point of having a projection without at least one line
...
...
@@ -282,8 +243,6 @@ ProjField = OPENS Spacing s:Specification CLOSES Spacing t:Type_form id:Identifi
Last = k:Keyword Spacing {{ value = k; }}
Declaration = Type Space+ Identifier Spacing SEMI Spacing ## not called from anywhere
Option = "projection"
Comment = Comment_start Comment_rest
...
...
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