[jboss-svn-commits] JBL Code SVN: r19970 - labs/jbossrules/branches/parser-rewrite/drools-compiler/src/main/resources/org/drools/lang.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri May 16 11:22:08 EDT 2008
Author: porcelli
Date: 2008-05-16 11:22:07 -0400 (Fri, 16 May 2008)
New Revision: 19970
Modified:
labs/jbossrules/branches/parser-rewrite/drools-compiler/src/main/resources/org/drools/lang/NewDRL.g
Log:
- Added package and imports
- Tree info improvements
Modified: labs/jbossrules/branches/parser-rewrite/drools-compiler/src/main/resources/org/drools/lang/NewDRL.g
===================================================================
--- labs/jbossrules/branches/parser-rewrite/drools-compiler/src/main/resources/org/drools/lang/NewDRL.g 2008-05-16 15:11:52 UTC (rev 19969)
+++ labs/jbossrules/branches/parser-rewrite/drools-compiler/src/main/resources/org/drools/lang/NewDRL.g 2008-05-16 15:22:07 UTC (rev 19970)
@@ -97,6 +97,32 @@
VK_COLLECT;
}
+ at parser::header {
+ package org.drools.lang;
+}
+
+ at lexer::header {
+ package org.drools.lang;
+}
+
+
+ at lexer::members {
+ /** The standard method called to automatically emit a token at the
+ * outermost lexical rule. The token object should point into the
+ * char buffer start..stop. If there is a text override in 'text',
+ * use that to set the token's text. Override this method to emit
+ * custom Token objects.
+ */
+ public Token emit() {
+ Token t = new DroolsToken(input, type, channel, tokenStartCharIndex, getCharIndex()-1);
+ t.setLine(tokenStartLine);
+ t.setText(text);
+ t.setCharPositionInLine(tokenStartCharPositionInLine);
+ emit(t);
+ return t;
+ }
+}
+
@parser::members {
private boolean validateLT(int LTNumber, String text){
if (null == input) return false;
@@ -145,8 +171,8 @@
;
function_import_statement
- : import_key function_key import_name SEMICOLON?
- -> ^(VT_FUNCTION_IMPORT function_key import_name)
+ : imp=import_key function_key import_name SEMICOLON?
+ -> ^(VT_FUNCTION_IMPORT[$imp.start] function_key import_name)
;
import_name
@@ -174,8 +200,9 @@
-> VT_FUNCTION_ID[$id]
;
-query : query_key query_id parameters? normal_lhs_block END SEMICOLON?
- -> ^(query_key query_id parameters? normal_lhs_block)
+query
+ : query_key query_id parameters? normal_lhs_block END SEMICOLON?
+ -> ^(query_key query_id parameters? normal_lhs_block END)
;
query_id
@@ -203,7 +230,7 @@
: template_key template_id SEMICOLON?
template_slot+
END SEMICOLON?
- -> ^(template_key template_id template_slot+)
+ -> ^(template_key template_id template_slot+ END)
;
template_id
@@ -496,7 +523,7 @@
@init{
boolean isArrow = false;
} : label accessor_path ( or_restr_connective | arw=ARROW paren_chunk {isArrow = true;})?
- -> {isArrow}? ^(VT_BIND_FIELD label ^(VT_FIELD accessor_path ^(VK_EVAL[$arw] paren_chunk)?))
+ -> {isArrow}? ^(VT_BIND_FIELD label ^(VT_FIELD accessor_path)) ^(VK_EVAL[$arw] paren_chunk)?
-> ^(VT_BIND_FIELD label ^(VT_FIELD accessor_path or_restr_connective?))
| accessor_path or_restr_connective
-> ^(VT_FIELD accessor_path or_restr_connective)
@@ -559,7 +586,7 @@
data_type
: ID ( DOT ID )* dimension_definition*
- -> ^(VT_DATA_TYPE ID+ dimension_definition*)
+ -> ^(VT_DATA_TYPE ID+ dimension_definition*)
;
dimension_definition
More information about the jboss-svn-commits
mailing list