-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various Cpp/C target fixes #145
base: master
Are you sure you want to change the base?
Commits on Jul 27, 2014
-
When you name your source files *.c, MSVC (2010) assumes it's compili…
…ng C, which means C89. All block-local variables need to be declared at the beginning of your functions. Or at begginning of {} block.
Configuration menu - View commit details
-
Copy full SHA for f03d333 - Browse repository at this point
Copy the full SHA f03d333View commit details -
Fix memory leak when using lexer rule label references.
Inspired by bennyk. Since this patch uses std::unique_ptr the build now requires a compiler supporting at least some of C++11 features.
Configuration menu - View commit details
-
Copy full SHA for f5d2f90 - Browse repository at this point
Copy the full SHA f5d2f90View commit details -
Fix lexer labels onto EOF token
+ minor fix - remover StringTemplate warning in matchSet/terminalOptions
Configuration menu - View commit details
-
Copy full SHA for 700d2df - Browse repository at this point
Copy the full SHA 700d2dfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c90ab8 - Browse repository at this point
Copy the full SHA 0c90ab8View commit details -
Configuration menu - View commit details
-
Copy full SHA for c243a87 - Browse repository at this point
Copy the full SHA c243a87View commit details -
Configuration menu - View commit details
-
Copy full SHA for 670347a - Browse repository at this point
Copy the full SHA 670347aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0ef2d9f - Browse repository at this point
Copy the full SHA 0ef2d9fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b60623 - Browse repository at this point
Copy the full SHA 5b60623View commit details -
Configuration menu - View commit details
-
Copy full SHA for dd3e20a - Browse repository at this point
Copy the full SHA dd3e20aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9420200 - Browse repository at this point
Copy the full SHA 9420200View commit details -
Configuration menu - View commit details
-
Copy full SHA for c93830e - Browse repository at this point
Copy the full SHA c93830eView commit details -
Do not use EOF macro in generated code
= The current code depends on the fact that EOF is #define EOF -1 is some standart C headers = While generated enums use EOF_TOKEN = Moreover EOF(-1) is signed value while LA an other methods return ANTLR_UINT32, this cause plenty of compiler warnings = Moreover clang++11 refuses compile code like this: switch(this->LA(1) { case EOF: // -1 ... This patch sets EOF_TOKEN = std::numerical_limits<ANTLR_UINT32>::max() All generated local varibles are of type ANTLR_UINT32 (instead of int) Generated conditions use EOF_TOKEN instead if pure EOF
Configuration menu - View commit details
-
Copy full SHA for e431dd4 - Browse repository at this point
Copy the full SHA e431dd4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9c9e336 - Browse repository at this point
Copy the full SHA 9c9e336View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6a4485d - Browse repository at this point
Copy the full SHA 6a4485dView commit details -
Configuration menu - View commit details
-
Copy full SHA for e35f17a - Browse repository at this point
Copy the full SHA e35f17aView commit details -
Configuration menu - View commit details
-
Copy full SHA for bec7e9c - Browse repository at this point
Copy the full SHA bec7e9cView commit details -
Allocate tree storage only withing context of the root grammar.
Configuration menu - View commit details
-
Copy full SHA for 0b4952b - Browse repository at this point
Copy the full SHA 0b4952bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 508797d - Browse repository at this point
Copy the full SHA 508797dView commit details
Commits on Aug 13, 2014
-
SEGFAULT fix - m_dirty flag (align with Java target)
Configuration menu - View commit details
-
Copy full SHA for 44ffe27 - Browse repository at this point
Copy the full SHA 44ffe27View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0626d13 - Browse repository at this point
Copy the full SHA 0626d13View commit details -
Performance improvement - do not alloc new instances of std::string i…
…n CommonToken::getText()
Configuration menu - View commit details
-
Copy full SHA for 7f32b85 - Browse repository at this point
Copy the full SHA 7f32b85View commit details -
Configuration menu - View commit details
-
Copy full SHA for 17dcc84 - Browse repository at this point
Copy the full SHA 17dcc84View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3c713e3 - Browse repository at this point
Copy the full SHA 3c713e3View commit details -
Explanation: For code(using labels e1, e2) like this: sample_clause : sample_key block_key? LEFT_PAREN e1=expression (COMMA e2=expression)? RIGHT_PAREN seed_part? -> ^(sample_key block_key? ^(EXPR $e1) ^(EXPR $e2)? seed_part?) ; ANTLR generates code like this: e1=expression(); ... if ( this->get_backtracking()==0 ) stream_expression.add(e1.tree); ... ... // AST REWRITE // elements: e1, e2, block_key, sample_key, seed_part // token labels: // rule labels: retval, e1, e2 // token list labels: // rule list labels: // wildcard labels: if ( this->get_backtracking()==0 ) { retval.tree = std::move(root_0); RewriteRuleSubtreeStream<ImplTraits> stream_retval(get_psrstate()->get_treeAdaptor(), "rule retval",retval.tree); // retval RewriteRuleSubtreeStream<ImplTraits> stream_e1(get_psrstate()->get_treeAdaptor(), "rule e1",e1.tree); // rewrite alias RewriteRuleSubtreeStream<ImplTraits> stream_e2(get_psrstate()->get_treeAdaptor(), "rule e2",e2.tree); // rewrite alias ... The variable e1 of type expression_return is assigned into two different SubTreeStreams. Since destructive copying is used(unique_ptr) the second assignment inserts NULL ptr into stream_e1. A new variable of type TreeType* (pure pointer) is added. A value of this pointer is used ONLY when inserting a tree into alias'es RewriteRuleSubtreeStream. When there are no aliases declared in the rule the "last pointer" remains unused. When inserting TreeTypePtr into a stream value is moved. When inserting a pure pointer into the aliases stream the whole tree is deeply dupped (assuming that the original tree was already moved into some other RewriteRuleSubtreeStream). New result: if ( this->get_backtracking()==0 ) { retval.tree = std::move(root_0); RewriteRuleSubtreeStream<ImplTraits> stream_retval(get_psrstate()->get_treeAdaptor(), "rule retval",retval.tree); // retval RewriteRuleSubtreeStream<ImplTraits> stream_e1(get_psrstate()->get_treeAdaptor(), "rule e1",e1_last); // rewrite alias RewriteRuleSubtreeStream<ImplTraits> stream_e2(get_psrstate()->get_treeAdaptor(), "rule e2",e2_last); // rewrite alias Note: we have also deal with this situation. unpivot_in_elements : ( column_name | LEFT_PAREN column_name (COMMA column_name)* RIGHT_PAREN ) ( as_key ( constant | (LEFT_PAREN)=> LEFT_PAREN constant (COMMA constant)* RIGHT_PAREN ) )? -> column_name+ ^(PIVOT_ALIAS constant+)? ; The AST tree contains multiple instances of "column_name". RewriteRuleSubtreeStream can not contain reference(pointer) into matched tree as it would get overwritten in every "loop". It really needs to be moved.
Configuration menu - View commit details
-
Copy full SHA for 3b7cc8d - Browse repository at this point
Copy the full SHA 3b7cc8dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 470eff5 - Browse repository at this point
Copy the full SHA 470eff5View commit details
Commits on Aug 15, 2014
-
Configuration menu - View commit details
-
Copy full SHA for c29d448 - Browse repository at this point
Copy the full SHA c29d448View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9ba24c5 - Browse repository at this point
Copy the full SHA 9ba24c5View commit details -
- unused #define macros removed - unused class templates removed - unused #include-s removed
Configuration menu - View commit details
-
Copy full SHA for 52eac3d - Browse repository at this point
Copy the full SHA 52eac3dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 11b73bf - Browse repository at this point
Copy the full SHA 11b73bfView commit details -
Sync tests with latest changes
= note: macros ANTLR_ENC_* are no more used = use enums antlr3::ENC_* instead
Configuration menu - View commit details
-
Copy full SHA for c28a3ef - Browse repository at this point
Copy the full SHA c28a3efView commit details -
Force all enum values (including EOF_TOKEN) to be unsigned
- removes compiler warning
Configuration menu - View commit details
-
Copy full SHA for 1ecc77e - Browse repository at this point
Copy the full SHA 1ecc77eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1e1405f - Browse repository at this point
Copy the full SHA 1e1405fView commit details -
create( ANTLR_UINT32 tokenType, const CommonTokenType* fromToken, const char* text);
Configuration menu - View commit details
-
Copy full SHA for fff2271 - Browse repository at this point
Copy the full SHA fff2271View commit details
Commits on Aug 16, 2014
-
Configuration menu - View commit details
-
Copy full SHA for e33569b - Browse repository at this point
Copy the full SHA e33569bView commit details
Commits on Aug 28, 2015
-
_LA renamed to LA Conflicts: runtime/Cpp/include/antlr3intstream.inl
Configuration menu - View commit details
-
Copy full SHA for 1e6ddad - Browse repository at this point
Copy the full SHA 1e6ddadView commit details -
_LT renamed to LT Conflicts: runtime/Cpp/include/antlr3treeparser.inl
Configuration menu - View commit details
-
Copy full SHA for 7365950 - Browse repository at this point
Copy the full SHA 7365950View commit details -
Configuration menu - View commit details
-
Copy full SHA for bfa144c - Browse repository at this point
Copy the full SHA bfa144cView commit details -
Reduce size of rule return class. Do not keep pointer onto parser in …
…every tree node. Conflicts: tool/src/main/resources/org/antlr/codegen/templates/Cpp/Cpp.stg
Configuration menu - View commit details
-
Copy full SHA for bdaf927 - Browse repository at this point
Copy the full SHA bdaf927View commit details -
Configuration menu - View commit details
-
Copy full SHA for 09e49a4 - Browse repository at this point
Copy the full SHA 09e49a4View commit details
Commits on Sep 4, 2015
-
Configuration menu - View commit details
-
Copy full SHA for b4839bf - Browse repository at this point
Copy the full SHA b4839bfView commit details -
add TreeTypePtr create( ANTLR_UINT32 tokenType, const CommonTokenType…
…* fromToken, StringType const& text);
Configuration menu - View commit details
-
Copy full SHA for 545bc01 - Browse repository at this point
Copy the full SHA 545bc01View commit details -
Reduce size of rule return class. Do not keep pointer onto parser in …
…every tree node.
Configuration menu - View commit details
-
Copy full SHA for 2ed5d99 - Browse repository at this point
Copy the full SHA 2ed5d99View commit details
Commits on Sep 5, 2015
-
_LA renamed to LA _LT renamed to LT Function name aligned _LT renamed to LT test synced _LT => LT
Configuration menu - View commit details
-
Copy full SHA for 9146932 - Browse repository at this point
Copy the full SHA 9146932View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7af3cd8 - Browse repository at this point
Copy the full SHA 7af3cd8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3552feb - Browse repository at this point
Copy the full SHA 3552febView commit details -
Configuration menu - View commit details
-
Copy full SHA for 14bd4a5 - Browse repository at this point
Copy the full SHA 14bd4a5View commit details
Commits on Sep 6, 2015
-
Configuration menu - View commit details
-
Copy full SHA for c8eabb4 - Browse repository at this point
Copy the full SHA c8eabb4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8557bc6 - Browse repository at this point
Copy the full SHA 8557bc6View commit details
Commits on Sep 17, 2015
-
Store additional information in Tokens member TokenUserDataType
Also: CommonTree<ImplTraits>::toString() calls Token's method toString() insted of getText() Test a007 shows how to use Token's UserData to pass information from Tree node to Tree leaf Test a007 shows how to override Tokens toString() method
Configuration menu - View commit details
-
Copy full SHA for b339647 - Browse repository at this point
Copy the full SHA b339647View commit details
Commits on Sep 28, 2015
-
Configuration menu - View commit details
-
Copy full SHA for 5cdcf00 - Browse repository at this point
Copy the full SHA 5cdcf00View commit details -
Configuration menu - View commit details
-
Copy full SHA for e28a57c - Browse repository at this point
Copy the full SHA e28a57cView commit details
Commits on Sep 30, 2015
-
Configuration menu - View commit details
-
Copy full SHA for 2808ae9 - Browse repository at this point
Copy the full SHA 2808ae9View commit details
Commits on Mar 31, 2016
-
Configuration menu - View commit details
-
Copy full SHA for a4d1928 - Browse repository at this point
Copy the full SHA a4d1928View commit details
Commits on May 11, 2016
-
Do not segfault when getTokenName(index) is out of bounds (return <UN…
…KNOWN> token name)
Configuration menu - View commit details
-
Copy full SHA for 45cc4eb - Browse repository at this point
Copy the full SHA 45cc4ebView commit details