Skip to content

Commit

Permalink
- updated to parse Modelica 3.0
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@3771 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Dec 13, 2008
1 parent a3474b0 commit 6c01359
Show file tree
Hide file tree
Showing 19 changed files with 6,404 additions and 4,364 deletions.
762 changes: 381 additions & 381 deletions tools/xml/flatmodelicaxml/flat_modelica_tree_parser.hpp

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions tools/xml/modelicaxml/ModelicaXML.cpp
Expand Up @@ -383,10 +383,11 @@ DOMElement* ModelicaXML::createModelicaXMLDOMElement(const char* fileName)
modelica_lexer *lexer = 0;
modelica_parser *parser = 0;
modelica_tree_parser *walker = 0;
antlr::ASTFactory *my_factory = 0;

try
{
antlr::ASTFactory *my_factory = new antlr::ASTFactory("MyAST", MyAST::factory);
my_factory = new antlr::ASTFactory("MyAST", MyAST::factory);
lexer = new modelica_lexer(file);
lexer->setFilename(fileName);
parser = new modelica_parser(*lexer);
Expand Down Expand Up @@ -433,9 +434,12 @@ DOMElement* ModelicaXML::createModelicaXMLDOMElement(const char* fileName)
//wfile << std::endl << "SUCCESS! File:" << fileName << std::endl;
//wfile.close();
// delete the lexer, parser and walker
// delete lexer;
// delete parser;
// delete walker;

if (lexer) delete lexer;
if (parser) delete parser;
if (walker) delete walker;
if (my_factory) delete my_factory;

return pRootElementModelicaXML;
}

Expand Down
10 changes: 5 additions & 5 deletions tools/xml/modelicaxml/ModelicaXML.vcproj
Expand Up @@ -204,7 +204,7 @@
>
<Tool
Name="VCCustomBuildTool"
CommandLine="java -cp &quot;C:\OMDev\bin\antlr\antlr.jar&quot; antlr.Tool $(InputPath)"
CommandLine="java -cp &quot;C:\OMDev\bin\antlr\antlr.jar&quot; antlr.Tool $(InputPath)&#x0D;&#x0A;"
Outputs="modelica_lexer.cpp modelica_lexer.hpp modelicaTokenTypes.txt"
/>
</FileConfiguration>
Expand All @@ -230,7 +230,7 @@
>
<Tool
Name="VCCustomBuildTool"
CommandLine="java -cp &quot;C:\OMDev\bin\antlr\antlr.jar&quot; antlr.Tool $(InputPath)"
CommandLine="java -cp &quot;C:\OMDev\bin\antlr\antlr.jar&quot; antlr.Tool $(InputPath)&#x0D;&#x0A;"
Outputs="modelica_parser.hpp modelica_parser.cpp modelica_parserTokenTypes.txt"
/>
</FileConfiguration>
Expand All @@ -239,7 +239,7 @@
>
<Tool
Name="VCCustomBuildTool"
CommandLine="java -cp &quot;C:\OMDev\bin\antlr\antlr.jar&quot; antlr.Tool $(InputPath)&#x0D;&#x0A;"
CommandLine="java -cp &quot;C:\OMDev\bin\antlr\antlr.jar&quot; antlr.Tool $(InputPath)&#x0D;&#x0A; "
AdditionalDependencies="modelica_lexer.hpp modelica_lexer.cpp"
Outputs="modelica_parser.hpp modelica_parser.cpp modelica_parserTokenTypes.txt"
/>
Expand Down Expand Up @@ -273,7 +273,7 @@
>
<Tool
Name="VCCustomBuildTool"
CommandLine="java -cp &quot;C:\OMDev\bin\antlr\antlr.jar&quot; antlr.Tool $(InputPath)"
CommandLine="java -cp &quot;C:\OMDev\bin\antlr\antlr.jar&quot; antlr.Tool $(InputPath)&#x0D;&#x0A;"
AdditionalDependencies="modelica_parser.cpp modelica_lexer.cpp"
Outputs="modelica_tree_parser.cpp modelica_tree_parser.hpp"
/>
Expand All @@ -283,7 +283,7 @@
>
<Tool
Name="VCCustomBuildTool"
CommandLine="java -cp &quot;C:\OMDev\bin\antlr\antlr.jar&quot; antlr.Tool $(InputPath)&#x0D;&#x0A;"
CommandLine="java -cp &quot;C:\OMDev\bin\antlr\antlr.jar&quot; antlr.Tool $(InputPath)&#x0D;&#x0A; "
AdditionalDependencies="modelica_parser.cpp modelica_lexer.cpp"
Outputs="modelica_tree_parser.cpp modelica_tree_parser.hpp"
/>
Expand Down
88 changes: 46 additions & 42 deletions tools/xml/modelicaxml/modelicaTokenTypes.hpp
Expand Up @@ -69,48 +69,52 @@ struct CUSTOM_API modelicaTokenTypes {
WHEN = 58,
WHILE = 59,
WITHIN = 60,
LPAR = 61,
RPAR = 62,
LBRACK = 63,
RBRACK = 64,
LBRACE = 65,
RBRACE = 66,
EQUALS = 67,
ASSIGN = 68,
PLUS = 69,
MINUS = 70,
STAR = 71,
SLASH = 72,
COMMA = 73,
LESS = 74,
LESSEQ = 75,
GREATER = 76,
GREATEREQ = 77,
EQEQ = 78,
LESSGT = 79,
COLON = 80,
SEMICOLON = 81,
POWER = 82,
YIELDS = 83,
AMPERSAND = 84,
PIPEBAR = 85,
COLONCOLON = 86,
DASHES = 87,
WS = 88,
ML_COMMENT = 89,
ML_COMMENT_CHAR = 90,
SL_COMMENT = 91,
IDENT = 92,
QIDENT = 93,
NONDIGIT = 94,
DIGIT = 95,
EXPONENT = 96,
UNSIGNED_INTEGER = 97,
STRING = 98,
SCHAR = 99,
QCHAR = 100,
SESCAPE = 101,
ESC = 102,
CONSTRAINEDBY = 61,
RETURN = 62,
BREAK = 63,
STREAM = 64,
LPAR = 65,
RPAR = 66,
LBRACK = 67,
RBRACK = 68,
LBRACE = 69,
RBRACE = 70,
EQUALS = 71,
ASSIGN = 72,
PLUS = 73,
MINUS = 74,
STAR = 75,
SLASH = 76,
POWER = 77,
PLUS_EW = 78,
MINUS_EW = 79,
STAR_EW = 80,
SLASH_EW = 81,
POWER_EW = 82,
COMMA = 83,
LESS = 84,
LESSEQ = 85,
GREATER = 86,
GREATEREQ = 87,
EQEQ = 88,
LESSGT = 89,
COLON = 90,
SEMICOLON = 91,
WS = 92,
ML_COMMENT = 93,
ML_COMMENT_CHAR = 94,
SL_COMMENT = 95,
IDENT = 96,
QIDENT = 97,
NONDIGIT = 98,
DIGIT = 99,
EXPONENT = 100,
UNSIGNED_INTEGER = 101,
STRING = 102,
SCHAR = 103,
QCHAR = 104,
SESCAPE = 105,
ESC = 106,
NULL_TREE_LOOKAHEAD = 3
};
#ifdef __cplusplus
Expand Down
88 changes: 46 additions & 42 deletions tools/xml/modelicaxml/modelicaTokenTypes.txt
Expand Up @@ -57,45 +57,49 @@ DOT="."=57
WHEN="when"=58
WHILE="while"=59
WITHIN="within"=60
LPAR=61
RPAR=62
LBRACK=63
RBRACK=64
LBRACE=65
RBRACE=66
EQUALS=67
ASSIGN=68
PLUS=69
MINUS=70
STAR=71
SLASH=72
COMMA=73
LESS=74
LESSEQ=75
GREATER=76
GREATEREQ=77
EQEQ=78
LESSGT=79
COLON=80
SEMICOLON=81
POWER=82
YIELDS=83
AMPERSAND=84
PIPEBAR=85
COLONCOLON=86
DASHES=87
WS=88
ML_COMMENT=89
ML_COMMENT_CHAR=90
SL_COMMENT=91
IDENT("an identifier")=92
QIDENT("an identifier")=93
NONDIGIT=94
DIGIT=95
EXPONENT=96
UNSIGNED_INTEGER=97
STRING=98
SCHAR=99
QCHAR=100
SESCAPE=101
ESC=102
CONSTRAINEDBY="constrainedby"=61
RETURN="return"=62
BREAK="break"=63
STREAM="stream"=64
LPAR=65
RPAR=66
LBRACK=67
RBRACK=68
LBRACE=69
RBRACE=70
EQUALS=71
ASSIGN=72
PLUS=73
MINUS=74
STAR=75
SLASH=76
POWER=77
PLUS_EW=78
MINUS_EW=79
STAR_EW=80
SLASH_EW=81
POWER_EW=82
COMMA=83
LESS=84
LESSEQ=85
GREATER=86
GREATEREQ=87
EQEQ=88
LESSGT=89
COLON=90
SEMICOLON=91
WS=92
ML_COMMENT=93
ML_COMMENT_CHAR=94
SL_COMMENT=95
IDENT("an identifier")=96
QIDENT("an identifier")=97
NONDIGIT=98
DIGIT=99
EXPONENT=100
UNSIGNED_INTEGER=101
STRING=102
SCHAR=103
QCHAR=104
SESCAPE=105
ESC=106

0 comments on commit 6c01359

Please sign in to comment.