From: <jfa...@us...> - 2011-08-21 19:31:08
|
Revision: 7136 http://oorexx.svn.sourceforge.net/oorexx/?rev=7136&view=rev Author: jfaucher Date: 2011-08-21 19:31:00 +0000 (Sun, 21 Aug 2011) Log Message: ----------- Refinement of tokens 'subclass' attribute (for analysis) Modified Paths: -------------- sandbox/jlf/_diary.txt sandbox/jlf/internals/notes/Parsing.txt sandbox/jlf/trunk/common/Utilities.hpp sandbox/jlf/trunk/common/platform/unix/SysUtilities.cpp sandbox/jlf/trunk/common/platform/windows/SysUtilities.cpp sandbox/jlf/trunk/interpreter/parser/InstructionParser.cpp sandbox/jlf/trunk/interpreter/parser/SourceFile.cpp sandbox/jlf/trunk/interpreter/parser/Token.cpp sandbox/jlf/trunk/interpreter/parser/Token.hpp Added Paths: ----------- sandbox/jlf/samples/parsing/ sandbox/jlf/samples/parsing/script-jedit.png sandbox/jlf/samples/parsing/script-parsing.txt sandbox/jlf/samples/parsing/script.rexx Modified: sandbox/jlf/_diary.txt =================================================================== --- sandbox/jlf/_diary.txt 2011-08-20 14:43:21 UTC (rev 7135) +++ sandbox/jlf/_diary.txt 2011-08-21 19:31:00 UTC (rev 7136) @@ -43,6 +43,34 @@ =============================================================================== +2011 aug 21 + +Refinement of tokens 'subclass' attribute (for analysis) : +The scanner splits a source file in clauses, and decompose each clause in tokens. +Then the parser creates an AST from the tokens. +The tokens were not annotated by the parser to attach semantic information found +during parsing. After a discussion with Rony about syntax coloring, I decided to +see which informations could be added to the tokens. I found that the attribute +'subclass' of the tokens could hold informations like that : +IS_KEYWORD +IS_SUBKEY +IS_DIRECTIVE +IS_SUBDIRECTIVE +IS_CONDITION +IS_BUILTIN +There is no impact on the interpreter, as far as I can tell... Except maybe the +tokenized files ? did not check. + +For the moment, there is no access to the clauses/tokens from an ooRexx script. +If the environment variable RXTRACE_PARSING=ON then the clauses and tokens are +dumped to the debug output (Windows) or the log (Unix) using dbgprintf. +See samples/parsing for an example of dump. + +Interesting to watch : +http://ibm-netrexx.215625.n3.nabble.com/NetRexx-Eclipse-status-video-td3271843.html + + +=============================================================================== 2011 aug 16 Fixed a crash in relation with source literals and GC. Modified: sandbox/jlf/internals/notes/Parsing.txt =================================================================== --- sandbox/jlf/internals/notes/Parsing.txt 2011-08-20 14:43:21 UTC (rev 7135) +++ sandbox/jlf/internals/notes/Parsing.txt 2011-08-21 19:31:00 UTC (rev 7136) @@ -1,3 +1,86 @@ +RexxCode *RexxSource::translate + RexxCode *newMethod = this->translateBlock(_labels); + while (!this->atEnd()) /* loop until end of source */ + { + this->directive(); /* process the directive */ + } + + + +void RexxSource::directive + switch (this->keyDirective(token)) + { /* match against the directive list */ + + case DIRECTIVE_CLASS: /* ::CLASS directive */ + classDirective(); + break; + + case DIRECTIVE_EXTENSION: /* ::EXTENSION directive */ + extensionDirective(); + break; + + case DIRECTIVE_METHOD: /* ::METHOD directive */ + methodDirective(); + break; + + case DIRECTIVE_ROUTINE: /* ::ROUTINE directive */ + routineDirective(); + break; + + case DIRECTIVE_REQUIRES: /* ::REQUIRES directive */ + requiresDirective(); + break; + + case DIRECTIVE_ATTRIBUTE: /* ::ATTRIBUTE directive */ + attributeDirective(); + break; + + case DIRECTIVE_CONSTANT: /* ::CONSTANT directive */ + constantDirective(); + break; + + case DIRECTIVE_OPTIONS: /* ::OPTIONS directive */ + optionsDirective(); + break; + + default: /* unknown directive */ + syntaxError(Error_Translation_bad_directive); + break; + } + + + +RexxInstruction *RexxSource::sourceNewObject +RexxInstruction *RexxSource::instruction +this->addClause(_instruction) + + +Refining token->subclass : + resolveKeyword, called by + subKeyword : done + keyword + builtin : done + resolveBuiltin : done + condition : done + parseOption : done + keyDirective : done + subDirective : done + + +Crash after changing builtin function codes from 1 to 2700 + CallInstruction.cpp + builtin_index = RexxSource::resolveBuiltin(_name); + result = (*(RexxSource::builtinTable[builtin_index]))(context, argcount, stack); + InstructionParser.cpp + builtin_index = this->builtin(token); + if (builtin_index != 0) refineSubclass(token, builtin_index); + new ((void *)newObject) RexxInstructionCall(name, _condition, argCount, this->subTerms, _flags, builtin_index); +--> better to cancel this change and just assign the same subclass 2700 to each token (their value is the name of the function) + + +============================================================================================= + + A propos du probl\xE8me de reset de location Added: sandbox/jlf/samples/parsing/script-jedit.png =================================================================== (Binary files differ) Property changes on: sandbox/jlf/samples/parsing/script-jedit.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: sandbox/jlf/samples/parsing/script-parsing.txt =================================================================== --- sandbox/jlf/samples/parsing/script-parsing.txt (rev 0) +++ sandbox/jlf/samples/parsing/script-parsing.txt 2011-08-21 19:31:00 UTC (rev 7136) @@ -0,0 +1,308 @@ +(Parsing)Add RexxInstruction : instructionType="KEYWORD_FIRST" instructionFlags=0 startLine=0 startCol=0 endLine=0 endCol=0 instruction={} +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#1 +(Parsing)parse="pattern" +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_ASSIGNMENT" instructionFlags=0 startLine=4 startCol=0 endLine=4 endCol=15 instruction={parse="pattern"} +(Parsing)startLine=4 startCol=0 endLine=4 endCol=5 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="PARSE" +(Parsing)startLine=4 startCol=5 endLine=4 endCol=6 classId=TOKEN_OPERATOR subclass=OPERATOR_EQUAL numeric=0 token="=" +(Parsing)startLine=4 startCol=6 endLine=4 endCol=15 classId=TOKEN_LITERAL subclass=0 numeric=0 token="pattern" +(Parsing)startLine=4 startCol=15 endLine=4 endCol=15 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)parse = parse "extending pattern" +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_ASSIGNMENT" instructionFlags=0 startLine=5 startCol=0 endLine=5 endCol=33 instruction={parse = parse "extending pattern"} +(Parsing)startLine=5 startCol=0 endLine=5 endCol=5 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="PARSE" +(Parsing)startLine=5 startCol=6 endLine=5 endCol=7 classId=TOKEN_OPERATOR subclass=OPERATOR_EQUAL numeric=0 token="=" +(Parsing)startLine=5 startCol=8 endLine=5 endCol=13 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="PARSE" +(Parsing)startLine=5 startCol=13 endLine=5 endCol=14 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=5 startCol=14 endLine=5 endCol=33 classId=TOKEN_LITERAL subclass=0 numeric=0 token="extending pattern" +(Parsing)startLine=5 startCol=33 endLine=5 endCol=33 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)parse var parse one two three +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_PARSE" instructionFlags=0 startLine=6 startCol=0 endLine=6 endCol=29 instruction={parse var parse one two three} +(Parsing)startLine=6 startCol=0 endLine=6 endCol=5 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="PARSE" +(Parsing)startLine=6 startCol=5 endLine=6 endCol=6 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=6 startCol=6 endLine=6 endCol=9 classId=TOKEN_SYMBOL subclass=IS_SUBKEY numeric=0 token="VAR" +(Parsing)startLine=6 startCol=9 endLine=6 endCol=10 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=6 startCol=10 endLine=6 endCol=15 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="PARSE" +(Parsing)startLine=6 startCol=15 endLine=6 endCol=16 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=6 startCol=16 endLine=6 endCol=19 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="ONE" +(Parsing)startLine=6 startCol=19 endLine=6 endCol=20 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=6 startCol=20 endLine=6 endCol=23 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="TWO" +(Parsing)startLine=6 startCol=23 endLine=6 endCol=24 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=6 startCol=24 endLine=6 endCol=29 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="THREE" +(Parsing)startLine=6 startCol=29 endLine=6 endCol=29 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)say "one:" one "from:" parse +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_SAY" instructionFlags=0 startLine=7 startCol=0 endLine=7 endCol=28 instruction={say "one:" one "from:" parse} +(Parsing)startLine=7 startCol=0 endLine=7 endCol=3 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="SAY" +(Parsing)startLine=7 startCol=3 endLine=7 endCol=4 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=7 startCol=4 endLine=7 endCol=10 classId=TOKEN_LITERAL subclass=0 numeric=0 token="one:" +(Parsing)startLine=7 startCol=10 endLine=7 endCol=11 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=7 startCol=11 endLine=7 endCol=14 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="ONE" +(Parsing)startLine=7 startCol=14 endLine=7 endCol=15 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=7 startCol=15 endLine=7 endCol=22 classId=TOKEN_LITERAL subclass=0 numeric=0 token="from:" +(Parsing)startLine=7 startCol=22 endLine=7 endCol=23 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=7 startCol=23 endLine=7 endCol=28 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="PARSE" +(Parsing)startLine=7 startCol=28 endLine=7 endCol=28 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)say "two:" two "from:" parse +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_SAY" instructionFlags=0 startLine=8 startCol=0 endLine=8 endCol=28 instruction={say "two:" two "from:" parse} +(Parsing)startLine=8 startCol=0 endLine=8 endCol=3 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="SAY" +(Parsing)startLine=8 startCol=3 endLine=8 endCol=4 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=8 startCol=4 endLine=8 endCol=10 classId=TOKEN_LITERAL subclass=0 numeric=0 token="two:" +(Parsing)startLine=8 startCol=10 endLine=8 endCol=11 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=8 startCol=11 endLine=8 endCol=14 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="TWO" +(Parsing)startLine=8 startCol=14 endLine=8 endCol=15 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=8 startCol=15 endLine=8 endCol=22 classId=TOKEN_LITERAL subclass=0 numeric=0 token="from:" +(Parsing)startLine=8 startCol=22 endLine=8 endCol=23 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=8 startCol=23 endLine=8 endCol=28 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="PARSE" +(Parsing)startLine=8 startCol=28 endLine=8 endCol=28 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)say "three:" three "from:" parse +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_SAY" instructionFlags=0 startLine=9 startCol=0 endLine=9 endCol=32 instruction={say "three:" three "from:" parse} +(Parsing)startLine=9 startCol=0 endLine=9 endCol=3 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="SAY" +(Parsing)startLine=9 startCol=3 endLine=9 endCol=4 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=9 startCol=4 endLine=9 endCol=12 classId=TOKEN_LITERAL subclass=0 numeric=0 token="three:" +(Parsing)startLine=9 startCol=12 endLine=9 endCol=13 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=9 startCol=13 endLine=9 endCol=18 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="THREE" +(Parsing)startLine=9 startCol=18 endLine=9 endCol=19 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=9 startCol=19 endLine=9 endCol=26 classId=TOKEN_LITERAL subclass=0 numeric=0 token="from:" +(Parsing)startLine=9 startCol=26 endLine=9 endCol=27 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=9 startCol=27 endLine=9 endCol=32 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="PARSE" +(Parsing)startLine=9 startCol=32 endLine=9 endCol=32 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)someValue="xyz pattern extedning pattern 123" +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_ASSIGNMENT" instructionFlags=0 startLine=11 startCol=0 endLine=11 endCol=45 instruction={someValue="xyz pattern extedning pattern 123"} +(Parsing)startLine=11 startCol=0 endLine=11 endCol=9 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="SOMEVALUE" +(Parsing)startLine=11 startCol=9 endLine=11 endCol=10 classId=TOKEN_OPERATOR subclass=OPERATOR_EQUAL numeric=0 token="=" +(Parsing)startLine=11 startCol=10 endLine=11 endCol=45 classId=TOKEN_LITERAL subclass=0 numeric=0 token="xyz pattern extedning pattern 123" +(Parsing)startLine=11 startCol=45 endLine=11 endCol=45 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)parse var someValue first (parse) last +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_PARSE" instructionFlags=0 startLine=12 startCol=0 endLine=12 endCol=38 instruction={parse var someValue first (parse) last} +(Parsing)startLine=12 startCol=0 endLine=12 endCol=5 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="PARSE" +(Parsing)startLine=12 startCol=5 endLine=12 endCol=6 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=12 startCol=6 endLine=12 endCol=9 classId=TOKEN_SYMBOL subclass=IS_SUBKEY numeric=0 token="VAR" +(Parsing)startLine=12 startCol=9 endLine=12 endCol=10 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=12 startCol=10 endLine=12 endCol=19 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="SOMEVALUE" +(Parsing)startLine=12 startCol=19 endLine=12 endCol=20 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=12 startCol=20 endLine=12 endCol=25 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="FIRST" +(Parsing)startLine=12 startCol=25 endLine=12 endCol=26 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=12 startCol=26 endLine=12 endCol=27 classId=TOKEN_LEFT subclass=0 numeric=0 token=NULL +(Parsing)startLine=12 startCol=27 endLine=12 endCol=32 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="PARSE" +(Parsing)startLine=12 startCol=32 endLine=12 endCol=33 classId=TOKEN_RIGHT subclass=0 numeric=0 token=NULL +(Parsing)startLine=12 startCol=33 endLine=12 endCol=34 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=12 startCol=34 endLine=12 endCol=38 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="LAST" +(Parsing)startLine=12 startCol=38 endLine=12 endCol=38 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)say "first:" first "from:" someValue", pattern:" parse +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_SAY" instructionFlags=0 startLine=13 startCol=0 endLine=13 endCol=54 instruction={say "first:" first "from:" someValue", pattern:" parse} +(Parsing)startLine=13 startCol=0 endLine=13 endCol=3 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="SAY" +(Parsing)startLine=13 startCol=3 endLine=13 endCol=4 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=13 startCol=4 endLine=13 endCol=12 classId=TOKEN_LITERAL subclass=0 numeric=0 token="first:" +(Parsing)startLine=13 startCol=12 endLine=13 endCol=13 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=13 startCol=13 endLine=13 endCol=18 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="FIRST" +(Parsing)startLine=13 startCol=18 endLine=13 endCol=19 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=13 startCol=19 endLine=13 endCol=26 classId=TOKEN_LITERAL subclass=0 numeric=0 token="from:" +(Parsing)startLine=13 startCol=26 endLine=13 endCol=27 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=13 startCol=27 endLine=13 endCol=36 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="SOMEVALUE" +(Parsing)startLine=13 startCol=36 endLine=13 endCol=48 classId=TOKEN_LITERAL subclass=0 numeric=0 token=", pattern:" +(Parsing)startLine=13 startCol=48 endLine=13 endCol=49 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=13 startCol=49 endLine=13 endCol=54 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="PARSE" +(Parsing)startLine=13 startCol=54 endLine=13 endCol=54 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)say "last:" last "from:" someValue", pattern:" parse +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_SAY" instructionFlags=0 startLine=14 startCol=0 endLine=14 endCol=52 instruction={say "last:" last "from:" someValue", pattern:" parse} +(Parsing)startLine=14 startCol=0 endLine=14 endCol=3 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="SAY" +(Parsing)startLine=14 startCol=3 endLine=14 endCol=4 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=14 startCol=4 endLine=14 endCol=11 classId=TOKEN_LITERAL subclass=0 numeric=0 token="last:" +(Parsing)startLine=14 startCol=11 endLine=14 endCol=12 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=14 startCol=12 endLine=14 endCol=16 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="LAST" +(Parsing)startLine=14 startCol=16 endLine=14 endCol=17 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=14 startCol=17 endLine=14 endCol=24 classId=TOKEN_LITERAL subclass=0 numeric=0 token="from:" +(Parsing)startLine=14 startCol=24 endLine=14 endCol=25 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=14 startCol=25 endLine=14 endCol=34 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="SOMEVALUE" +(Parsing)startLine=14 startCol=34 endLine=14 endCol=46 classId=TOKEN_LITERAL subclass=0 numeric=0 token=", pattern:" +(Parsing)startLine=14 startCol=46 endLine=14 endCol=47 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=14 startCol=47 endLine=14 endCol=52 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="PARSE" +(Parsing)startLine=14 startCol=52 endLine=14 endCol=52 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)if=1 +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_ASSIGNMENT" instructionFlags=0 startLine=17 startCol=0 endLine=17 endCol=4 instruction={if=1} +(Parsing)startLine=17 startCol=0 endLine=17 endCol=2 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="IF" +(Parsing)startLine=17 startCol=2 endLine=17 endCol=3 classId=TOKEN_OPERATOR subclass=OPERATOR_EQUAL numeric=0 token="=" +(Parsing)startLine=17 startCol=3 endLine=17 endCol=4 classId=TOKEN_SYMBOL subclass=SYMBOL_CONSTANT numeric=1258 token="1" +(Parsing)startLine=17 startCol=4 endLine=17 endCol=4 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)then=1 +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_ASSIGNMENT" instructionFlags=0 startLine=18 startCol=0 endLine=18 endCol=6 instruction={then=1} +(Parsing)startLine=18 startCol=0 endLine=18 endCol=4 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="THEN" +(Parsing)startLine=18 startCol=4 endLine=18 endCol=5 classId=TOKEN_OPERATOR subclass=OPERATOR_EQUAL numeric=0 token="=" +(Parsing)startLine=18 startCol=5 endLine=18 endCol=6 classId=TOKEN_SYMBOL subclass=SYMBOL_CONSTANT numeric=1258 token="1" +(Parsing)startLine=18 startCol=6 endLine=18 endCol=6 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)else=1 +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_ASSIGNMENT" instructionFlags=0 startLine=19 startCol=0 endLine=19 endCol=6 instruction={else=1} +(Parsing)startLine=19 startCol=0 endLine=19 endCol=4 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="ELSE" +(Parsing)startLine=19 startCol=4 endLine=19 endCol=5 classId=TOKEN_OPERATOR subclass=OPERATOR_EQUAL numeric=0 token="=" +(Parsing)startLine=19 startCol=5 endLine=19 endCol=6 classId=TOKEN_SYMBOL subclass=SYMBOL_CONSTANT numeric=1258 token="1" +(Parsing)startLine=19 startCol=6 endLine=19 endCol=6 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)if if then say then "from branch #1" +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_IF" instructionFlags=0 startLine=21 startCol=0 endLine=21 endCol=6 instruction={if if } +(Parsing)Add RexxInstruction : instructionType="KEYWORD_IFTHEN" instructionFlags=0 startLine=21 startCol=6 endLine=21 endCol=10 instruction={then} +(Parsing)Add RexxInstruction : instructionType="KEYWORD_SAY" instructionFlags=0 startLine=21 startCol=11 endLine=21 endCol=36 instruction={say then "from branch #1"} +(Parsing)Add RexxInstruction : instructionType="KEYWORD_ENDTHEN" instructionFlags=0 startLine=21 startCol=11 endLine=21 endCol=36 instruction={say then "from branch #1"} +(Parsing)startLine=21 startCol=0 endLine=21 endCol=2 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="IF" +(Parsing)startLine=21 startCol=2 endLine=21 endCol=3 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=21 startCol=3 endLine=21 endCol=5 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="IF" +(Parsing)startLine=21 startCol=5 endLine=21 endCol=6 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=21 startCol=6 endLine=21 endCol=10 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="THEN" +(Parsing)startLine=21 startCol=10 endLine=21 endCol=11 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=21 startCol=11 endLine=21 endCol=14 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="SAY" +(Parsing)startLine=21 startCol=14 endLine=21 endCol=15 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=21 startCol=15 endLine=21 endCol=19 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="THEN" +(Parsing)startLine=21 startCol=19 endLine=21 endCol=20 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=21 startCol=20 endLine=21 endCol=36 classId=TOKEN_LITERAL subclass=0 numeric=0 token="from branch #1" +(Parsing)startLine=21 startCol=36 endLine=21 endCol=36 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)else if else then say else "from branch #2" +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_ELSE" instructionFlags=0 startLine=22 startCol=6 endLine=22 endCol=10 instruction={else} +(Parsing)Add RexxInstruction : instructionType="KEYWORD_IF" instructionFlags=0 startLine=22 startCol=11 endLine=22 endCol=19 instruction={if else } +(Parsing)Add RexxInstruction : instructionType="KEYWORD_IFTHEN" instructionFlags=0 startLine=22 startCol=19 endLine=22 endCol=23 instruction={then} +(Parsing)Add RexxInstruction : instructionType="KEYWORD_SAY" instructionFlags=0 startLine=22 startCol=24 endLine=22 endCol=49 instruction={say else "from branch #2"} +(Parsing)Add RexxInstruction : instructionType="KEYWORD_ENDTHEN" instructionFlags=0 startLine=22 startCol=24 endLine=22 endCol=49 instruction={say else "from branch #2"} +(Parsing)startLine=22 startCol=6 endLine=22 endCol=10 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="ELSE" +(Parsing)startLine=22 startCol=10 endLine=22 endCol=11 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=22 startCol=11 endLine=22 endCol=13 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="IF" +(Parsing)startLine=22 startCol=13 endLine=22 endCol=14 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=22 startCol=14 endLine=22 endCol=18 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="ELSE" +(Parsing)startLine=22 startCol=18 endLine=22 endCol=19 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=22 startCol=19 endLine=22 endCol=23 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="THEN" +(Parsing)startLine=22 startCol=23 endLine=22 endCol=24 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=22 startCol=24 endLine=22 endCol=27 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="SAY" +(Parsing)startLine=22 startCol=27 endLine=22 endCol=28 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=22 startCol=28 endLine=22 endCol=32 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="ELSE" +(Parsing)startLine=22 startCol=32 endLine=22 endCol=33 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=22 startCol=33 endLine=22 endCol=49 classId=TOKEN_LITERAL subclass=0 numeric=0 token="from branch #2" +(Parsing)startLine=22 startCol=49 endLine=22 endCol=49 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)say "if: " if +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_ENDELSE" instructionFlags=0 startLine=24 startCol=0 endLine=24 endCol=14 instruction={say "if: " if} +(Parsing)Add RexxInstruction : instructionType="KEYWORD_SAY" instructionFlags=0 startLine=24 startCol=0 endLine=24 endCol=14 instruction={say "if: " if} +(Parsing)startLine=24 startCol=0 endLine=24 endCol=3 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="SAY" +(Parsing)startLine=24 startCol=3 endLine=24 endCol=4 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=24 startCol=4 endLine=24 endCol=11 classId=TOKEN_LITERAL subclass=0 numeric=0 token="if: " +(Parsing)startLine=24 startCol=11 endLine=24 endCol=12 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=24 startCol=12 endLine=24 endCol=14 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="IF" +(Parsing)startLine=24 startCol=14 endLine=24 endCol=14 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)say "then:" then +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_SAY" instructionFlags=0 startLine=25 startCol=0 endLine=25 endCol=16 instruction={say "then:" then} +(Parsing)startLine=25 startCol=0 endLine=25 endCol=3 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="SAY" +(Parsing)startLine=25 startCol=3 endLine=25 endCol=4 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=25 startCol=4 endLine=25 endCol=11 classId=TOKEN_LITERAL subclass=0 numeric=0 token="then:" +(Parsing)startLine=25 startCol=11 endLine=25 endCol=12 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=25 startCol=12 endLine=25 endCol=16 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="THEN" +(Parsing)startLine=25 startCol=16 endLine=25 endCol=16 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)say "else:" else +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_SAY" instructionFlags=0 startLine=26 startCol=0 endLine=26 endCol=16 instruction={say "else:" else} +(Parsing)startLine=26 startCol=0 endLine=26 endCol=3 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="SAY" +(Parsing)startLine=26 startCol=3 endLine=26 endCol=4 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=26 startCol=4 endLine=26 endCol=11 classId=TOKEN_LITERAL subclass=0 numeric=0 token="else:" +(Parsing)startLine=26 startCol=11 endLine=26 endCol=12 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=26 startCol=12 endLine=26 endCol=16 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="ELSE" +(Parsing)startLine=26 startCol=16 endLine=26 endCol=16 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)raise propagate -- will "propagate" be highlighted as a subkeyword in this context? +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_RAISE" instructionFlags=0 startLine=29 startCol=0 endLine=29 endCol=84 instruction={raise propagate -- will "propagate" be highlighted as a subkeyword in this context?} +(Parsing)startLine=29 startCol=0 endLine=29 endCol=5 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="RAISE" +(Parsing)startLine=29 startCol=5 endLine=29 endCol=6 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=29 startCol=6 endLine=29 endCol=15 classId=TOKEN_SYMBOL subclass=IS_CONDITION numeric=0 token="PROPAGATE" +(Parsing)startLine=29 startCol=84 endLine=29 endCol=84 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)propagate=.true -- will ".true" be highlighed, but "propagate" not in this conetxt? +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_ASSIGNMENT" instructionFlags=0 startLine=30 startCol=0 endLine=30 endCol=84 instruction={propagate=.true -- will ".true" be highlighed, but "propagate" not in this conetxt?} +(Parsing)startLine=30 startCol=0 endLine=30 endCol=9 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="PROPAGATE" +(Parsing)startLine=30 startCol=9 endLine=30 endCol=10 classId=TOKEN_OPERATOR subclass=OPERATOR_EQUAL numeric=0 token="=" +(Parsing)startLine=30 startCol=10 endLine=30 endCol=15 classId=TOKEN_SYMBOL subclass=SYMBOL_DOTSYMBOL numeric=0 token=".TRUE" +(Parsing)startLine=30 startCol=84 endLine=30 endCol=84 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)raise syntax 17.1 array ("someValue") -- will "syntax" and "array" be highlighted in this context? +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_RAISE" instructionFlags=2 startLine=32 startCol=0 endLine=32 endCol=98 instruction={raise syntax 17.1 array ("someValue") -- will "syntax" and "array" be highlighted in this context?} +(Parsing)startLine=32 startCol=0 endLine=32 endCol=5 classId=TOKEN_SYMBOL subclass=IS_KEYWORD numeric=0 token="RAISE" +(Parsing)startLine=32 startCol=5 endLine=32 endCol=6 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=32 startCol=6 endLine=32 endCol=12 classId=TOKEN_SYMBOL subclass=IS_CONDITION numeric=0 token="SYNTAX" +(Parsing)startLine=32 startCol=12 endLine=32 endCol=13 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=32 startCol=13 endLine=32 endCol=17 classId=TOKEN_SYMBOL subclass=SYMBOL_CONSTANT numeric=0 token="17.1" +(Parsing)startLine=32 startCol=17 endLine=32 endCol=18 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=32 startCol=18 endLine=32 endCol=23 classId=TOKEN_SYMBOL subclass=IS_SUBKEY numeric=0 token="ARRAY" +(Parsing)startLine=32 startCol=23 endLine=32 endCol=24 classId=TOKEN_BLANK subclass=OPERATOR_BLANK numeric=0 token=" " +(Parsing)startLine=32 startCol=24 endLine=32 endCol=25 classId=TOKEN_LEFT subclass=0 numeric=0 token=NULL +(Parsing)startLine=32 startCol=25 endLine=32 endCol=36 classId=TOKEN_LITERAL subclass=0 numeric=0 token="someValue" +(Parsing)startLine=32 startCol=36 endLine=32 endCol=37 classId=TOKEN_RIGHT subclass=0 numeric=0 token=NULL +(Parsing)startLine=32 startCol=98 endLine=32 endCol=98 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing)array=.array~of(1,2,3) -- will "array" be highlighted in this context? +(Parsing) +(Parsing)Add RexxInstruction : instructionType="KEYWORD_ASSIGNMENT" instructionFlags=0 startLine=33 startCol=0 endLine=33 endCol=70 instruction={array=.array~of(1,2,3) -- will "array" be highlighted in this context?} +(Parsing)startLine=33 startCol=0 endLine=33 endCol=5 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="ARRAY" +(Parsing)startLine=33 startCol=5 endLine=33 endCol=6 classId=TOKEN_OPERATOR subclass=OPERATOR_EQUAL numeric=0 token="=" +(Parsing)startLine=33 startCol=6 endLine=33 endCol=12 classId=TOKEN_SYMBOL subclass=SYMBOL_DOTSYMBOL numeric=0 token=".ARRAY" +(Parsing)startLine=33 startCol=12 endLine=33 endCol=13 classId=TOKEN_TILDE subclass=0 numeric=0 token=NULL +(Parsing)startLine=33 startCol=13 endLine=33 endCol=15 classId=TOKEN_SYMBOL subclass=SYMBOL_VARIABLE numeric=0 token="OF" +(Parsing)startLine=33 startCol=15 endLine=33 endCol=16 classId=TOKEN_LEFT subclass=0 numeric=0 token=NULL +(Parsing)startLine=33 startCol=16 endLine=33 endCol=17 classId=TOKEN_SYMBOL subclass=SYMBOL_CONSTANT numeric=1258 token="1" +(Parsing)startLine=33 startCol=17 endLine=33 endCol=18 classId=TOKEN_COMMA subclass=0 numeric=0 token=NULL +(Parsing)startLine=33 startCol=18 endLine=33 endCol=19 classId=TOKEN_SYMBOL subclass=SYMBOL_CONSTANT numeric=1258 token="2" +(Parsing)startLine=33 startCol=19 endLine=33 endCol=20 classId=TOKEN_COMMA subclass=0 numeric=0 token=NULL +(Parsing)startLine=33 startCol=20 endLine=33 endCol=21 classId=TOKEN_SYMBOL subclass=SYMBOL_CONSTANT numeric=1258 token="3" +(Parsing)startLine=33 startCol=21 endLine=33 endCol=22 classId=TOKEN_RIGHT subclass=0 numeric=0 token=NULL +(Parsing)startLine=33 startCol=70 endLine=33 endCol=70 classId=TOKEN_EOC subclass=CLAUSEEND_EOL numeric=0 token=NULL +(Parsing)------------------------------------------------- +(Parsing)From RexxSource::translateBlock#7 +(Parsing) +(Parsing) Property changes on: sandbox/jlf/samples/parsing/script-parsing.txt ___________________________________________________________________ Added: svn:eol-style + LF Added: sandbox/jlf/samples/parsing/script.rexx =================================================================== --- sandbox/jlf/samples/parsing/script.rexx (rev 0) +++ sandbox/jlf/samples/parsing/script.rexx 2011-08-21 19:31:00 UTC (rev 7136) @@ -0,0 +1,34 @@ +-- Sress script provided by Rony. +-- Regarding the syntax coloring, jEdit is on the knees with this source, see bitmap. + +parse="pattern" +parse = parse "extending pattern" +parse var parse one two three +say "one:" one "from:" parse +say "two:" two "from:" parse +say "three:" three "from:" parse + +someValue="xyz pattern extedning pattern 123" +parse var someValue first (parse) last +say "first:" first "from:" someValue", pattern:" parse +say "last:" last "from:" someValue", pattern:" parse + + +if=1 +then=1 +else=1 + +if if then say then "from branch #1" + else if else then say else "from branch #2" + +say "if: " if +say "then:" then +say "else:" else + + +raise propagate -- will "propagate" be highlighted as a subkeyword in this context? +propagate=.true -- will ".true" be highlighed, but "propagate" not in this conetxt? + +raise syntax 17.1 array ("someValue") -- will "syntax" and "array" be highlighted in this context? +array=.array~of(1,2,3) -- will "array" be highlighted in this context? + Modified: sandbox/jlf/trunk/common/Utilities.hpp =================================================================== --- sandbox/jlf/trunk/common/Utilities.hpp 2011-08-20 14:43:21 UTC (rev 7135) +++ sandbox/jlf/trunk/common/Utilities.hpp 2011-08-21 19:31:00 UTC (rev 7136) @@ -67,6 +67,8 @@ static wholenumber_t currentThreadId(); // Could be in SysThread.hpp, but for the moment, it's here... static void traceConcurrency(bool); static bool traceConcurrency(); + static void traceParsing(bool); + static bool traceParsing(); }; #endif Modified: sandbox/jlf/trunk/common/platform/unix/SysUtilities.cpp =================================================================== --- sandbox/jlf/trunk/common/platform/unix/SysUtilities.cpp 2011-08-20 14:43:21 UTC (rev 7135) +++ sandbox/jlf/trunk/common/platform/unix/SysUtilities.cpp 2011-08-21 19:31:00 UTC (rev 7136) @@ -47,7 +47,7 @@ /** * Encapsulation of vsnprintf Unix implementation. - * The goal is to have the same behavior on all platforms. + * The goal is to have the same behavior on all platforms. * * @param buffer Buffer receiving the formated output. * @param size Size of buffer. @@ -63,23 +63,23 @@ http://linux.die.net/man/3/snprintf Return value - Upon successful return, return the number of characters printed (not including the trailing '\0' used to end output to strings). - The functions snprintf() do not write more than size bytes (including the trailing '\0'). + Upon successful return, return the number of characters printed (not including the trailing '\0' used to end output to strings). + The functions snprintf() do not write more than size bytes (including the trailing '\0'). If the output was truncated due to this limit then the return value is the number of characters (not including the trailing '\0') which would have been written to the final string if enough space had been available. - Thus, a return value of size or more means that the output was truncated. (See also below under NOTES.) + Thus, a return value of size or more means that the output was truncated. (See also below under NOTES.) If an output error is encountered, a negative value is returned. Conforming To The snprintf() function conform to C99. - Concerning the return value of snprintf(), SUSv2 and C99 contradict each other: - when snprintf() is called with size=0 then SUSv2 stipulates an unspecified return value less than 1, + Concerning the return value of snprintf(), SUSv2 and C99 contradict each other: + when snprintf() is called with size=0 then SUSv2 stipulates an unspecified return value less than 1, while C99 allows str to be NULL in this case, and gives the return value (as always) as the number of characters that would have been written in case the output string has been large enough. Notes The glibc implementation of the functions snprintf() conforms to the C99 standard, i.e., behaves as described above, since glibc version 2.1. - Until glibc 2.0.6 they would return -1 when the output was truncated. + Until glibc 2.0.6 they would return -1 when the output was truncated. */ - + /* vsnprintf behavior, assuming the buffer is 4 bytes : 0 1 2 3 @@ -89,7 +89,7 @@ "xxxx" x x x \0 return value = 4 <-- different from Windows "xxxxx" x x x \0 return value = 5 <-- different from Windows */ - + if (buffer == NULL || count == 0 || format == NULL) return -1; int n = ::vsnprintf(buffer, count, format, args); buffer[count-1] = '\0'; // Normally not needed, but... @@ -100,7 +100,7 @@ /** * Encapsulation of snprintf Unix implementation. - * The goal is to have the same behavior on all platforms. + * The goal is to have the same behavior on all platforms. * * @param buffer Buffer receiving the formated output. * @param size Size of buffer. @@ -121,9 +121,9 @@ // Could be in SysThread.cpp, but for the moment, it's here... -wholenumber_t Utilities::currentThreadId() -{ - return (wholenumber_t)pthread_self(); +wholenumber_t Utilities::currentThreadId() +{ + return (wholenumber_t)pthread_self(); } @@ -139,7 +139,7 @@ bool Utilities::traceConcurrency() { // I don't put this part of code in SystemInterpreter::setupProgram - // where RXTRACE is managed, because would be initialized too late : + // where RXTRACE is managed, because would be initialized too late : // Some mutexes/semaphores have been already used before calling setupProgram. static bool firstcall = true; if (firstcall) @@ -158,3 +158,32 @@ return TRACE_CONCURRENCY; } + +// This indicator is used to control the display of additional informations in the trace output while parsing. +static bool TRACE_PARSING = false; + +void Utilities::traceParsing(bool trace) +{ + TRACE_PARSING = trace; +} + + +bool Utilities::traceParsing() +{ + static bool firstcall = true; + if (firstcall) + { + firstcall = false; + const char *rxTraceBuf = getenv("RXTRACE_PARSING"); + if (rxTraceBuf != NULL) + { + if (!Utilities::strCaselessCompare(rxTraceBuf, "ON")) /* request to turn on? */ + { + /* turn on tracing */ + Utilities::traceParsing(true); + } + } + } + return TRACE_PARSING; +} + Modified: sandbox/jlf/trunk/common/platform/windows/SysUtilities.cpp =================================================================== --- sandbox/jlf/trunk/common/platform/windows/SysUtilities.cpp 2011-08-20 14:43:21 UTC (rev 7135) +++ sandbox/jlf/trunk/common/platform/windows/SysUtilities.cpp 2011-08-21 19:31:00 UTC (rev 7136) @@ -48,8 +48,8 @@ #include "Utilities.hpp" /** - * Encapsulation of _vsnprintf Windows implementation. - * The goal is to have the same behavior on all platforms. + * Encapsulation of _vsnprintf Windows implementation. + * The goal is to have the same behavior on all platforms. * * @param buffer Buffer receiving the formated output. * @param size Size of buffer. @@ -65,14 +65,14 @@ http://msdn.microsoft.com/en-us/library/1kt27hek%28v=VS.71%29.aspx Return value - _vsnprintf returns the number of bytes stored in buffer, not counting the terminating null character. - If the number of bytes required to store the data exceeds count, then count bytes of data are stored in buffer and a negative value is returned. - + _vsnprintf returns the number of bytes stored in buffer, not counting the terminating null character. + If the number of bytes required to store the data exceeds count, then count bytes of data are stored in buffer and a negative value is returned. + Remarks The _snprintf function formats and stores count or fewer characters and values (including a terminating null character that is always appended - unless count is zero or the formatted string length is greater than or equal to count characters) in buffer. + unless count is zero or the formatted string length is greater than or equal to count characters) in buffer. */ - + /* _vsnprintf behavior, assuming the buffer is 4 bytes : 0 1 2 3 @@ -82,7 +82,7 @@ "xxxx" x x x x return value = -1 (truncated, no final '\0') "xxxxx" x x x x return value = -1 (truncated, no final '\0') */ - + if (buffer == NULL || count == 0) return -1; int n = _vsnprintf(buffer, count, format, args); buffer[count-1] = '\0'; // Unlike Unix implementation, we are not sure to have a final '\0' @@ -92,7 +92,7 @@ /** * Encapsulation of snprintf Windows implementation. - * The goal is to have the same behavior on all platforms. + * The goal is to have the same behavior on all platforms. * * @param buffer Buffer receiving the formated output. * @param size Size of buffer. @@ -113,9 +113,9 @@ // Could be in SysThread.cpp, but for the moment, it's here... -wholenumber_t Utilities::currentThreadId() -{ - return (wholenumber_t)GetCurrentThreadId(); +wholenumber_t Utilities::currentThreadId() +{ + return (wholenumber_t)GetCurrentThreadId(); } @@ -131,7 +131,7 @@ bool Utilities::traceConcurrency() { // I don't put this part of code in SystemInterpreter::setupProgram - // where RXTRACE is managed, because would be initialized too late : + // where RXTRACE is managed, because would be initialized too late : // Some mutexes/semaphores have been already used before calling setupProgram. static bool firstcall = true; if (firstcall) @@ -149,3 +149,32 @@ } return TRACE_CONCURRENCY; } + +// This indicator is used to control the display of additional informations in the trace output while parsing. +static bool TRACE_PARSING = false; + +void Utilities::traceParsing(bool trace) +{ + TRACE_PARSING = trace; +} + + +bool Utilities::traceParsing() +{ + static bool firstcall = true; + if (firstcall) + { + firstcall = false; + TCHAR rxTraceBuf[8]; + if (GetEnvironmentVariable("RXTRACE_PARSING", rxTraceBuf, 8)) + { + if (!Utilities::strCaselessCompare(rxTraceBuf, "ON")) /* request to turn on? */ + { + /* turn on tracing */ + Utilities::traceParsing(true); + } + } + } + return TRACE_PARSING; +} + Modified: sandbox/jlf/trunk/interpreter/parser/InstructionParser.cpp =================================================================== --- sandbox/jlf/trunk/interpreter/parser/InstructionParser.cpp 2011-08-20 14:43:21 UTC (rev 7135) +++ sandbox/jlf/trunk/interpreter/parser/InstructionParser.cpp 2011-08-21 19:31:00 UTC (rev 7136) @@ -131,6 +131,7 @@ /* may be value keyword, however... */ if (this->subKeyword(token) == SUBKEY_VALUE) { + refineSubclass(token, IS_SUBKEY); /* process the expression */ _expression = this->expression(TERM_EOC); if (_expression == OREF_NULL) /* no expression? */ @@ -235,6 +236,7 @@ int _keyword = this->subKeyword(token); /* check for the subkeywords */ if (_keyword == SUBKEY_ON) { /* CALL ON instruction? */ + refineSubclass(token, IS_SUBKEY); _flags |= RexxInstructionCall::call_on_off; /* this is a CALL ON */ token = nextReal(); /* get the next token */ /* no condition specified or not a */ @@ -260,6 +262,7 @@ /* actually a USER condition request?*/ else if (_keyword == CONDITION_USER) { + refineSubclass(token, IS_CONDITION); token = nextReal(); /* get the next token */ /* no condition specified or not a */ /* symbol? */ @@ -271,6 +274,7 @@ /* set the builtin index for later */ /* resolution step */ builtin_index = this->builtin(token); + if (builtin_index != 0) refineSubclass(token, IS_BUILTIN); _condition = token->value; /* get the token string value */ name = _condition; /* set the default target */ /* condition name is "USER condition"*/ @@ -285,6 +289,7 @@ /* set the builtin index for later */ /* resolution step */ builtin_index = this->builtin(token); + if (builtin_index != 0) refineSubclass(token, IS_BUILTIN); } token = nextReal(); /* get the next token */ /* anything real here? */ @@ -302,6 +307,7 @@ /* got an error here */ syntaxError(Error_Invalid_subkeyword_callonname, token); } + refineSubclass(token, IS_SUBKEY); token = nextReal(); /* get the next token */ if (token->classId != TOKEN_SYMBOL && token->classId != TOKEN_LITERAL) { @@ -312,6 +318,7 @@ /* set the builtin index for later */ /* resolution step */ builtin_index = this->builtin(token); + if (builtin_index != 0) refineSubclass(token, IS_BUILTIN); token = nextReal(); /* get the next token */ /* must have the clause end here */ if (!token->isEndOfClause()) @@ -323,6 +330,7 @@ } else if (_keyword == SUBKEY_OFF) { /* CALL OFF instruction? */ + refineSubclass(token, IS_SUBKEY); token = nextReal(); /* get the next token */ /* no condition specified or not a */ /* symbol? */ @@ -347,6 +355,7 @@ /* actually a USER condition request?*/ else if (_keyword == CONDITION_USER) { + refineSubclass(token, IS_CONDITION); token = nextReal(); /* get the next token */ /* no condition specified or not a */ /* symbol? */ @@ -379,6 +388,7 @@ /* set the builtin index for later */ /* resolution step */ builtin_index = this->builtin(token); + if (builtin_index != 0) refineSubclass(token, IS_BUILTIN); /* get the argument list */ argCount = this->argList(OREF_NULL, TERM_EOC); } @@ -390,6 +400,7 @@ /* set the builtin index for later */ /* resolution step */ builtin_index = this->builtin(token); + if (builtin_index != 0) refineSubclass(token, IS_BUILTIN); /* process the argument list */ argCount = this->argList(OREF_NULL, TERM_EOC); _flags |= RexxInstructionCall::call_nointernal; /* do not check for internal routines*/ @@ -500,6 +511,7 @@ RexxToken *name = nextReal(); if (name->isSymbol()) { + refineSubclass(token, IS_SUBKEY); OrefSet(newDo, newDo->label, name->value); // update the reset position before stepping to the next position _position = markPosition(); @@ -583,6 +595,7 @@ { case SUBKEY_BY: + refineSubclass(token, IS_SUBKEY); // only one per customer if (newDo->by != OREF_NULL) { @@ -600,6 +613,7 @@ break; case SUBKEY_TO: + refineSubclass(token, IS_SUBKEY); // only one per customer if (newDo->to != OREF_NULL) { @@ -617,6 +631,7 @@ break; case SUBKEY_FOR: + refineSubclass(token, IS_SUBKEY); // only one per customer if (newDo->forcount != OREF_NULL) { @@ -634,6 +649,7 @@ break; case SUBKEY_WHILE: + refineSubclass(token, IS_SUBKEY); // step back a token and process the conditional previousToken(); OrefSet(newDo, newDo->conditional, this->parseConditional(NULL, 0)); @@ -643,6 +659,7 @@ break; case SUBKEY_UNTIL: + refineSubclass(token, IS_SUBKEY); // step back a token and process the conditional previousToken(); OrefSet(newDo, newDo->conditional, this->parseConditional(NULL, 0)); @@ -657,6 +674,7 @@ // DO name OVER collection form? else if (this->subKeyword(second) == SUBKEY_OVER) { + refineSubclass(second, IS_SUBKEY); // this is a DO OVER type newDo->type = DO_OVER; // if this DO/LOOP didn't have a label clause, use the control @@ -697,6 +715,7 @@ { case SUBKEY_FOREVER: // DO FOREVER + refineSubclass(token, IS_SUBKEY); newDo->type = DO_FOREVER; // this has a potential conditional OrefSet(newDo, newDo->conditional, this->parseConditional(&conditional, Error_Invalid_do_forever)); @@ -712,6 +731,7 @@ break; case SUBKEY_WHILE: // DO WHILE cond */ + refineSubclass(token, IS_SUBKEY); // step back one token and process the conditional previousToken(); OrefSet(newDo, newDo->conditional, this->parseConditional(&conditional, 0)); @@ -719,6 +739,7 @@ break; case SUBKEY_UNTIL: // DO WHILE cond */ + refineSubclass(token, IS_SUBKEY); // step back one token and process the conditional previousToken(); OrefSet(newDo, newDo->conditional, this->parseConditional(&conditional, 0)); @@ -884,6 +905,7 @@ { /* get the keyword value */ case SUBKEY_TO: /* FORWARD TO expr */ + refineSubclass(token, IS_SUBKEY); /* have a description already? */ if (newObject->target != OREF_NULL) { @@ -901,6 +923,7 @@ break; case SUBKEY_CLASS: /* FORWARD CLASS expr */ + refineSubclass(token, IS_SUBKEY); /* have a class over ride already? */ if (newObject->superClass != OREF_NULL) { @@ -918,6 +941,7 @@ break; case SUBKEY_MESSAGE: /* FORWARD MESSAGE expr */ + refineSubclass(token, IS_SUBKEY); /* have a message over ride already? */ if (newObject->message != OREF_NULL) { @@ -935,6 +959,7 @@ break; case SUBKEY_ARGUMENTS: /* FORWARD ARGUMENTS expr */ + refineSubclass(token, IS_SUBKEY); /* have a additional already? */ if (newObject->arguments != OREF_NULL || newObject->array != OREF_NULL) { @@ -952,6 +977,7 @@ break; case SUBKEY_ARRAY: /* FORWARD ARRAY (expr, expr) */ + refineSubclass(token, IS_SUBKEY); /* have arguments already? */ if (newObject->arguments != OREF_NULL || newObject->array != OREF_NULL) { @@ -970,6 +996,7 @@ break; case SUBKEY_CONTINUE: /* FORWARD CONTINUE */ + refineSubclass(token, IS_SUBKEY); if (returnContinue) /* already had the return action? */ { /* this is invalid */ @@ -1023,10 +1050,12 @@ switch (this->subKeyword(token)) { case SUBKEY_OFF: /* GUARD OFF instruction */ + refineSubclass(token, IS_SUBKEY); on_off = false; /* this is the guard off form */ break; case SUBKEY_ON: /* GUARD ON instruction */ + refineSubclass(token, IS_SUBKEY); on_off = true; /* remember it is the on form */ break; @@ -1043,6 +1072,7 @@ { /* and process */ case SUBKEY_WHEN: /* GUARD ON WHEN expr */ + refineSubclass(token, IS_SUBKEY); this->setGuard(); /* turn on guard variable collection */ /* process the expression */ _expression = this->expression(TERM_EOC); @@ -1304,6 +1334,7 @@ } unsigned short type = this->subKeyword(token); /* resolve the subkeyword */ + if (type != 0) refineSubclass(token, IS_SUBKEY); switch (type) { ... [truncated message content] |