Commit e775c983 authored by Sarah Spall's avatar Sarah Spall Committed by Vikram Narayanan

changed to support new 'verbatim' section rather than c include, and changed...

changed to support new 'verbatim' section rather than c include, and changed makefile in an attempt to figure out why modified h file wasn't being used, now delete .gch file
parent ea133a9d
all: lcd_compiler
lcd_compiler: lcd_idl.o lcd_ast.o lcd_compiler.o
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.o: lcd_compiler.cpp lcd_idl.h
g++ -c -g lcd_compiler.cpp lcd_idl.h
lcd_compiler.o: lcd_compiler.cpp lcd_ast.h lcd_idl.h
g++ -c -g lcd_compiler.cpp
lcd_ast.o: lcd_ast.cpp lcd_ast.h
g++ -c -g lcd_ast.cpp lcd_ast.h
lcd_idl.o: lcd_idl.h lcd_ast.h
lcd_idl.o: lcd_ast.h lcd_idl.cpp lcd_idl.h
g++ -c -g lcd_idl.cpp lcd_idl.h
lcd_ast.o: lcd_ast.h
lcd_idl.cpp:
vembyr-1.1/peg.py --cpp lcd_idl.peg > lcd_idl.cpp
lcd_idl.h:
vembyr-1.1/peg.py --h lcd_idl.peg > lcd_idl.h
lcd_idl.h:
vembyr-1.1/peg.py --h lcd_idl.peg > lcd_idl.h
lcd_idl.cpp:
vembyr-1.1/peg.py --cpp lcd_idl.peg > lcd_idl.cpp
clean:
rm lcd_idl.cpp lcd_idl.h compiler *.o
\ No newline at end of file
rm lcd_idl.cpp lcd_idl.h lcd_ast.h.gch compiler *.o
\ No newline at end of file
......@@ -12,10 +12,10 @@ ProjectionType::ProjectionType(char * type_name, bool pointer)
this->pointer_ = pointer;
}
Scope::Scope(std::vector<char* >* includes, std::vector<Rpc* >* rpc_definitions, std::vector<Message* >* message_definitions,
Scope::Scope(char* verbatim, std::vector<Rpc* >* rpc_definitions, std::vector<Message* >* message_definitions,
std::map<char* , Projection* >* projection_definitions)
{
this->includes_ = includes;
this->verbatim_ = verbatim;
this->rpc_definitions_ = rpc_definitions;
this->message_definitions_ = message_definitions;
this->projection_definitions_ = projection_definitions;
......
......@@ -123,14 +123,14 @@ class Message : public Definition
class Scope
{
std::vector<char* >* includes_;
char* verbatim_;
std::vector<Rpc *>* rpc_definitions_;
std::vector<Message *>* message_definitions_;
std::map<char *, Projection *>* projection_definitions_;
// believe it is only necessary to store projections in "env" since functions can't be referenced in other functions
public:
Scope(std::vector<char* >* includes, std::vector<Rpc* >* rpc_definitions, std::vector<Message* >* message_definitions,
Scope(char* verbatim, std::vector<Rpc* >* rpc_definitions, std::vector<Message* >* message_definitions,
std::map<char* , Projection* >* projection_definitions);
};
......
......@@ -9,8 +9,6 @@ include: {{ #include "lcd_ast.h"
rules:
Identifier = i1:IdentStart i2:IdentCont* Spacing {{
std::ostringstream total;
total << (char) (intptr_t) i1.getValue();
......@@ -28,7 +26,7 @@ IdentStart = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
IdentCont = IdentStart | [0123456789]
File = Spacing i:Include* t:Things* <eof> {{ std::vector<Definition *>* defs = new std::vector<Definition *>;
File = Spacing v:Verbatim t:Things* <eof> {{ std::vector<Definition *>* defs = new std::vector<Definition *>;
std::vector<Rpc *>* rpcs = new std::vector<Rpc *>;
std::vector<Message *>* messages = new std::vector<Message *>;
std::map<char *, Projection *> *env = new std::map<char *, Projection *>;
......@@ -68,14 +66,19 @@ File = Spacing i:Include* t:Things* <eof> {{ std::vector<Definition *>* defs =
}
}
std::vector<char *>* includes = new std::vector<char *>;
for(Value::iterator it2 = i.getValues().begin(); it2 != i.getValues().end(); it2 ++)
value = new Scope((char*) v.getValue(), rpcs, messages, env); }}
Verbatim = "verbatim" Spacing "[" contents:VerbatimContent "]" {{ std::ostringstream total;
for(Value::iterator it = contents.getValues().begin(); it != contents.getValues().end(); it ++)
{
const Value & v = *it2;
char * c = (char *) v.getValue();
includes->push_back(c);
const Value &v = *it;
char letter = (char) (intptr_t) v.getValue();
total << letter;
}
value = new Scope(includes, rpcs, messages, env); }}
std::string str = total.str();
value = &str[0]; }}
VerbatimContent = !"]" .
String = <ascii 34> l:any_letter+ <ascii 34> {{
std::ostringstream total;
......@@ -278,7 +281,7 @@ Type_w_modifier = m:Modifier Space+ s:Simple_Type {{
Type = Type_w_modifier
| s:Simple_Type {{
int* sval = (int*) s.getValue();
value = new PrimitiveType(kNone, (PrimType) *sval); }}
value = new PrimitiveType(kNone, (PrimType) *sval); }}
## just ignore the modules ones, not supporting right now
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment