From a7200f4dd53cc7dc9a445f2ac7db03b376459aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 31 Dec 2017 17:36:19 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D1=8B=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BA=D0=BB?= =?UTF-8?q?=D1=8E=D1=87=D0=B0=D1=82=D0=B5=D0=BB=D0=B8=20=D1=80=D0=B5=D0=B6?= =?UTF-8?q?=D0=B8=D0=BC=D0=BE=D0=B2=20=D0=B2=C2=A0=D0=BF=D0=B0=D1=80=D1=81?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=20=D0=A0=D0=B5=D1=84=D0=B0=D0=BB=D0=B0-5?= =?UTF-8?q?=CE=BB=20(#144)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../compatibility/classic-extended.OK.ref | 168 ++++++++++++ autotests/compatibility/run.bat | 42 ++- autotests/compatibility/run.sh | 33 ++- src/compiler/Config.sref | 17 ++ src/compiler/Driver.sref | 8 +- src/compiler/ParseCmdLine.sref | 10 +- src/compiler/R5-Lexer.ref | 16 ++ src/compiler/R5-Parser.ref | 239 +++++++++++------- 8 files changed, 427 insertions(+), 106 deletions(-) create mode 100644 autotests/compatibility/classic-extended.OK.ref diff --git a/autotests/compatibility/classic-extended.OK.ref b/autotests/compatibility/classic-extended.OK.ref new file mode 100644 index 00000000..c8557d24 --- /dev/null +++ b/autotests/compatibility/classic-extended.OK.ref @@ -0,0 +1,168 @@ +*$CLASSIC +*$EXTENDED + +$ENTRY +*$CLASSIC; +Go +*$EXTENDED; +{ +*$CLASSIC + = +*$EXTENDED + ; + +*$CLASSIC; + ( +*$EXTENDED; + A +*$CLASSIC + ( +*$EXTENDED + 10 +*$CLASSIC; + "BCD" +*$EXTENDED; + 'efgh' +*$CLASSIC + ) +*$EXTENDED + ) +*$CLASSIC; + Q +*$EXTENDED; + = +*$CLASSIC + +*$CLASSIC; + R +*$EXTENDED; + ) +*$CLASSIC + 's' +*$EXTENDED + 't' +*$CLASSIC; + > +*$EXTENDED; + ; +*$CLASSIC + + Pattern +*$EXTENDED + , +*$CLASSIC; + CondResult1 +*$EXTENDED; + : + CondPattern1 +*$EXTENDED + , +*$CLASSIC; + CondResult2 +*$EXTENDED; + : +*$CLASSIC + CondPattern2 +*$EXTENDED + = +*$CLASSIC; + Result +*$EXTENDED; + ; + +*$CLASSIC + Pattern +*$EXTENDED + , +*$CLASSIC; + CondResult1 +*$EXTENDED; + : +*$CLASSIC + CondPattern1 +*$EXTENDED + , +*$CLASSIC; + BlockResult2 +*$EXTENDED; + : +*$CLASSIC + { +*$EXTENDED + BlockPattern1 +*$CLASSIC; + = +*$EXTENDED; + BlockResult1 +*$CLASSIC + ; +*$EXTENDED + BlockPattern2 +*$CLASSIC; + , +*$EXTENDED; + BlockCondResult1 +*$CLASSIC + : +*$EXTENDED + BlockCondPattern1 +*$CLASSIC; + = +*$EXTENDED; + BlockResult2 +*$CLASSIC; + ; +*$EXTENDED + } +*$CLASSIC; + ; + +*$EXTENDED; + Pattern +*$CLASSIC; + , +*$EXTENDED + BlockResult +*$CLASSIC; + : +*$EXTENDED; + { +*$CLASSIC; + BlockPattern +*$EXTENDED + = +*$CLASSIC; + BlockResult +*$EXTENDED; + /*;*/ +*$CLASSIC; + } +*$EXTENDED + ; +*$CLASSIC; +} +*$EXTENDED + +$EXTERN +*$CLASSIC; +Foo +*$EXTENDED; +, +*$CLASSIC +Bar +*$EXTENDED +, +*$CLASSIC; +Baz +*$EXTENDED; +; diff --git a/autotests/compatibility/run.bat b/autotests/compatibility/run.bat index f2ccd9a0..f435f7c6 100644 --- a/autotests/compatibility/run.bat +++ b/autotests/compatibility/run.bat @@ -62,7 +62,7 @@ goto :EOF :: Поиск srefc if exist ..\..\bin\srefc-core.exe ( - set REFAL_COMPILERS=srefc %REFAL_COMPILERS% + set REFAL_COMPILERS=srefc_classic srefc_lambda %REFAL_COMPILERS% set SREFC_EXIST=1 echo ... found srefc call ..\..\scripts\load-config.bat || exit /b 1 @@ -231,7 +231,7 @@ setlocal endlocal goto :EOF -:COMPILE.srefc +:COMPILE_SREFC_COMMON setlocal set SRC=%1 set TARGET=%~n1.exe @@ -253,7 +253,14 @@ setlocal endlocal goto :EOF -:EXECUTE_OK.srefc +:COMPILE.srefc_classic +setlocal + set COMMON_SRFLAGS=%COMMON_SRFLAGS% --classic + call :COMPILE_SREFC_COMMON "%~1" || exit /b 1 +endlocal +goto :EOF + +:EXECUTE_OK.srefc_classic setlocal set EXE=%~n1.exe echo Y| %EXE% Hello "Hello, World" "" \ > stdout.txt 2>stderr.txt @@ -266,7 +273,7 @@ setlocal endlocal goto :EOF -:EXECUTE_FAIL.srefc +:EXECUTE_FAIL.srefc_classic setlocal set EXE=%~n1.exe echo Y| %EXE% > stdout.txt @@ -287,7 +294,7 @@ setlocal endlocal goto :EOF -:CLEANUP.srefc +:CLEANUP.srefc_classic setlocal call :CLEANUP_COMMON if exist "%~1.rasl" erase "%~1.rasl" @@ -297,6 +304,31 @@ setlocal endlocal goto :EOF +:COMPILE.srefc_lambda +setlocal + set COMMON_SRFLAGS=%COMMON_SRFLAGS% --extended + call :COMPILE_SREFC_COMMON "%~1" || exit /b 1 +endlocal +goto :EOF + +:EXECUTE_OK.srefc_lambda +setlocal + call :EXECUTE_OK.srefc_classic "%~1" || exit /b 1 +endlocal +goto :EOF + +:EXECUTE_FAIL.srefc_lambda +setlocal + call :EXECUTE_FAIL.srefc_lambda "%~1" || exit /b 1 +endlocal +exit /b 0 + +:CLEANUP.srefc_lambda +setlocal + call :CLEANUP.srefc_classic "%~1" || exit /b 1 +endlocal +goto :EOF + :COMPILE.crefal setlocal set RSL="%~n1"-crefal.rsl diff --git a/autotests/compatibility/run.sh b/autotests/compatibility/run.sh index f1ce5b60..15fd7398 100755 --- a/autotests/compatibility/run.sh +++ b/autotests/compatibility/run.sh @@ -67,7 +67,7 @@ lookup_compilers() { # Поиск srefc if [ -e ../../bin/srefc-core ]; then - REFAL_COMPILERS="srefc $REFAL_COMPILERS" + REFAL_COMPILERS="srefc_classic srefc_lambda $REFAL_COMPILERS" SREFC_EXIST=1 echo ... found srefc source ../../scripts/load-config.sh ../.. || return 1 @@ -215,11 +215,12 @@ run_test_result_SYNTAX-ERROR() { done } -compile_srefc() { +compile_srefc_common() { SRC=$1 TARGET=${SRC%%.ref}$(platform_exe_suffix) + FLAGS_EX=$2 - ../../bin/srefc-core $SRC -o $TARGET "${COMMON_SRFLAGS[@]}" \ + ../../bin/srefc-core $SRC -o $TARGET "${COMMON_SRFLAGS[@]}" $FLAGS_EX \ --prefix=_test_prefix external 2>__error.txt if [ $? -ge 100 ]; then echo COMPILER FAILS ON $SRC, SEE __error.txt @@ -231,7 +232,11 @@ compile_srefc() { rm __error.txt } -execute_OK_srefc() { +compile_srefc_classic() { + compile_srefc_common "$1" --classic || return 1 +} + +execute_OK_srefc_classic() { SRC=$1 EXE=${SRC%%.ref}$(platform_exe_suffix) echo Y | ./$EXE Hello "Hello, World" "" $SEP > stdout.txt 2>stderr.txt || { @@ -241,7 +246,7 @@ execute_OK_srefc() { } } -execute_FAIL_srefc() { +execute_FAIL_srefc_classic() { SRC=$1 EXE=${SRC%%.ref}$(platform_exe_suffix) if echo Y | ./$EXE > stdout.txt; then @@ -256,7 +261,7 @@ cleanup_common() { rm -f __dump.txt $OUTPUT_FILES REFAL7.DAT } -cleanup_srefc() { +cleanup_srefc_classic() { cleanup_common SRC=$1 RASL=${SRC%%.ref}.rasl @@ -266,6 +271,22 @@ cleanup_srefc() { rm -f external.rasl } +compile_srefc_lambda() { + compile_srefc_common "$1" --extended || return 1 +} + +execute_OK_srefc_lambda() { + execute_OK_srefc_classic "$1" || return 1 +} + +execute_FAIL_srefc_lambda() { + execute_FAIL_srefc_classic "$1" || return 1 +} + +cleanup_srefc_lambda() { + cleanup_srefc_classic "$1" || return 1 +} + compile_crefal() { SRC=$1 RSL=${SRC%%.ref}-crefal.rsl diff --git a/src/compiler/Config.sref b/src/compiler/Config.sref index 94079ba3..7f7a3b8b 100644 --- a/src/compiler/Config.sref +++ b/src/compiler/Config.sref @@ -28,6 +28,7 @@ $ENTRY Config-Create { (#Incorporateds /* пусто */) (#ChmodXCommand /* пусто */) (#Prelude /* пусто */) + (#Refal5Mode #Extended) ]; } @@ -543,3 +544,19 @@ $ENTRY Config-SetPrelude { [Config e.Params-B (#Prelude e.OldPrelude) e.Params-E] e.NewPrelude = #Success [Config e.Params-B (#Prelude e.NewPrelude) e.Params-E]; } + +/** + == s.Refal5Mode + s.Refal5Mode ::= #Classic | #Extended +*/ +$ENTRY Config-GetR5Mode { + [Config e.Params-B (#Refal5Mode s.Mode) e.Params-E] = s.Mode; +} + +/** + == #Success t.Config +*/ +$ENTRY Config-SetR5Mode { + [Config e.Params-B (#Refal5Mode s.OldMode) e.Params-E] s.NewMode + = #Success [Config e.Params-B (#Refal5Mode s.NewMode) e.Params-E]; +} diff --git a/src/compiler/Driver.sref b/src/compiler/Driver.sref index e3d03e2a..9fd34089 100644 --- a/src/compiler/Driver.sref +++ b/src/compiler/Driver.sref @@ -7,6 +7,7 @@ $EXTERN EL-Destroy, EL-Create, EL-AddErrorAt, EL-Concat; //FROM Config $EXTERN Config-GetPrelude, + Config-GetR5Mode, Config-GetSearchFolders, Config-GetDebugMode, Config-GetOptPattern, @@ -98,9 +99,9 @@ FrontEnd { } R5-Parse-Wrapped { - (e.SrcName) e.Tokens + s.Mode (e.SrcName) e.Tokens = : t.ErrorList - = : (e.Errors) e.AST + = : (e.Errors) e.AST = : e.Tokens - = : t.ErrorList e.AST + = : s.Mode + = : t.ErrorList e.AST = t.ErrorList e.AST; t.Config #SR e.SrcName diff --git a/src/compiler/ParseCmdLine.sref b/src/compiler/ParseCmdLine.sref index d407409a..dc238ab1 100644 --- a/src/compiler/ParseCmdLine.sref +++ b/src/compiler/ParseCmdLine.sref @@ -10,7 +10,7 @@ $EXTERN Config-Create, Config-SetCppCompiler, Config-SetCompilerFlags, Config-SetDebugInfo, Config-SetGrammarCheck, Config-SetTargetFileName, Config-SetTargetSuffix, Config-SetSearchFolder, Config-SetPrefix, Config-AddReference, Config-SetTargetMode, Config-AddIncorporated, - Config-SetChmodXCommand, Config-SetPrelude; + Config-SetChmodXCommand, Config-SetPrelude, Config-SetR5Mode; /** @@ -49,6 +49,8 @@ $ENTRY ParseCommandLine { (#TargetSuffix-Lib #Required ('libsuffix') ('libsuf')) (#ChmodXCommand #Required ('chmod-x') ('chmod-x-command')) (#Prelude #Required ('prelude')) + (#ClassicMode #None ('classic')) + (#ExtendedMode #None ('extended')) ) e.Arguments > @@ -156,6 +158,12 @@ $ENTRY ParseCommandLine { (t.Config e.Errors) (#Prelude s.Num e.Prelude) = ; + (t.Config e.Errors) (#ClassicMode s.Num) + = ; + + (t.Config e.Errors) (#ExtendedMode s.Num) + = ; + (t.Config e.Errors) t.Option = (t.Config e.Errors) t.Option; } diff --git a/src/compiler/R5-Lexer.ref b/src/compiler/R5-Lexer.ref index 579f8b3b..c1275d32 100644 --- a/src/compiler/R5-Lexer.ref +++ b/src/compiler/R5-Lexer.ref @@ -67,6 +67,22 @@ DoScan { t.Pos ('/*' e.Line) e.Lines = ; + (RowCol s.Line 1) ('*$CLASSIC') e.Lines + = (TkRefal5Mode (RowCol s.Line 1) Classic) + 1) e.Lines>; + + (RowCol s.Line 1) ('*$EXTENDED') e.Lines + = (TkRefal5Mode (RowCol s.Line 1) Extended) + 1) e.Lines>; + + (RowCol s.Line 1) ('*$CLASSIC;') e.Lines + = (TkRefal5Mode (RowCol s.Line 1) Classic) + 1) e.Lines>; + + (RowCol s.Line 1) ('*$EXTENDED;') e.Lines + = (TkRefal5Mode (RowCol s.Line 1) Extended) + 1) e.Lines>; + (RowCol s.Line 1) ('*' e.Comment) e.Lines = 1) e.Lines>; diff --git a/src/compiler/R5-Parser.ref b/src/compiler/R5-Parser.ref index 5022e8be..378681d5 100644 --- a/src/compiler/R5-Parser.ref +++ b/src/compiler/R5-Parser.ref @@ -1,7 +1,9 @@ /** - + == (t.Error*) t.Unit* + s.Mode ::= Classic | Extended + t.Error ::= (t.Pos e.Message) t.Unit ::= t.Function | t.Extern t.Extern ::= (Declaration NoPos GN-Entry e.Name) @@ -25,7 +27,7 @@ s.VarType ::= 's' | 't' | 'e' */ $ENTRY R5-Parse { - e.Tokens = >; + s.Mode e.Tokens = >; } FilterErrors { @@ -48,24 +50,27 @@ DoFilterErrors { /* Program = Unit* EOF. - == t.ErrorUnit* + == t.ErrorUnit* t.ErrorUnit ::= (Error t.Pos e.Message) | t.Unit */ Program { - t.NextToken e.Tokens, + s.Mode t.NextToken e.Tokens, t.NextToken: (s.Type t.Pos e.Value), : True = - >; + >; + + s.Mode (TkRefal5Mode t.Pos s.NewMode) e.Tokens + = ; - (TkEOF t.Pos) = /* всё */; + s.Mode (TkEOF t.Pos) = /* всё */; - t.Unexpected e.Tokens, + s.Mode t.Unexpected e.Tokens, t.Unexpected: (s.Type t.Pos e.Value) = - ; + ; } OneOf { @@ -74,16 +79,16 @@ OneOf { } Program-AfterUnit { - (e.ErrorsUnits) e.Tokens = e.ErrorsUnits ; + s.Mode (e.ErrorsUnits) e.Tokens = e.ErrorsUnits ; } /* Unit = SPECIAL-COMMENT | "$EXTERN" NameList | Function. - == (t.ErrorUnit*) e.Tokens + == (t.ErrorUnit*) e.Tokens */ Unit { - t.NextToken e.Tokens, + s.Mode t.NextToken e.Tokens, t.NextToken: { (TkExtern t.Pos) = @@ -94,7 +99,7 @@ Unit { (s.Type t.Pos e.Value), : True = - ; + ; /* других типов быть не должно */ } @@ -111,6 +116,8 @@ NameList { ( /* externs and errors */) e.Tokens >; + (TkRefal5Mode t.Pos s.Mode) e.Tokens = ; + t.NextToken e.Tokens, t.NextToken: (s.Type t.Pos e.Value) = ((Error t.Pos 'expected function name after $EXTERN keyword')) @@ -122,6 +129,14 @@ Extern { } NameList-DoNames { + (e.ExternsAndErrors) + (TkRefal5Mode t.Pos s.Mode) e.Tokens + = ; + + (e.ExternsAndErrors) + (TkComma t.CommaPos) (TkRefal5Mode t.ModePos s.Mode) e.Tokens + = ; + (e.ExternsAndErrors) (TkComma t.CommaPos) (TkName t.NamePos e.Name) e.Tokens = ) e.Tokens>; @@ -168,20 +183,23 @@ NameList-DoNames { /* Function = ["$ENTRY"] NAME Block. - == (e.Errors t.FunctionUnit) e.Tokens + == (e.Errors t.FunctionUnit) e.Tokens */ Function { - (TkEntry t.EntryPos) (TkName t.NamePos e.Name) e.Tokens = + s.Mode (TkEntry t.EntryPos) (TkName t.NamePos e.Name) e.Tokens = + t.EntryPos (e.Name) GN-Entry >; - (TkName t.Pos e.Name) e.Tokens = + s.Mode (TkName t.Pos e.Name) e.Tokens = + t.Pos (e.Name) GN-Local >; - (TkEntry t.Pos) e.Tokens = + s.Mode (TkEntry t.EntryPos) (TkRefal5Mode t.ModePos s.NewMode) e.Tokens + = ; + + s.Mode (TkEntry t.Pos) e.Tokens = ((Error t.Pos '$ENTRY without function name, skipped')) e.Tokens; } @@ -196,27 +214,44 @@ Function-AfterBlock { /* Block = "{" Sentence { ";" Sentence } [";"] "}". - == (e.Errors) (e.Sentences) e.Tokens + == (e.Errors) (e.Sentences) e.Tokens */ Block { - (TkOpenBlock t.Pos) e.Tokens = + s.Mode (TkOpenBlock t.Pos) e.Tokens = + s.Mode (/* errors */) (/* sentences */) + >; - t.Unexpected e.Tokens = + s.Mode (TkRefal5Mode t.Pos s.NewMode) e.Tokens + = ; + + s.Mode t.Unexpected e.Tokens = () (/* no sentences */) t.Unexpected e.Tokens; } Block-AfterSentence { - (e.Errors) (e.Sentences) + s.Mode (e.Errors) (e.Sentences) (e.SentenceErrors) t.NextSentence t.Token1 t.Token2 e.Tokens, t.Token1 t.Token2: { + (TkSemicolon t.SemicolonPos) (TkRefal5Mode t.ModePos s.NewMode) + = ; + + (TkRefal5Mode t.Pos s.NewMode) t.Token2_ + = ; + (TkSemicolon t.Pos1) (TkCloseBlock t.Pos2) = + >; t.Token1 t.Token2 = ) (e.Sentences t.NextSentence) - + > }; @@ -275,37 +311,40 @@ CheckEmptyBlock { /* Sentence = Pattern ("=" Result | "," ExtensionChain). - == (e.Errors) t.Sentence e.Tokens + == (e.Errors) t.Sentence e.Tokens */ Sentence { - e.Tokens = - >; + s.Mode (TkRefal5Mode t.Pos s.NewMode) e.Tokens + = ; + + s.Mode e.Tokens = + >; } Sentence-AfterPattern { - (e.Errors) t.Pattern (TkAssign t.Pos) e.Tokens = + s.Mode (e.Errors) t.Pattern (TkAssign t.Pos) e.Tokens = + (e.Errors) t.Pattern >; - (e.Errors) t.Pattern (TkComma t.Pos) e.Tokens = + s.Mode (e.Errors) t.Pattern (TkComma t.Pos) e.Tokens = + (e.Errors) t.Pattern >; - (e.Errors) t.Pattern (TkSemicolon t.Pos) e.Tokens = + s.Mode (e.Errors) t.Pattern (TkSemicolon t.Pos) e.Tokens = + >; - (e.Errors) t.Pattern (TkColon t.Pos) e.Tokens = + s.Mode (e.Errors) t.Pattern (TkColon t.Pos) e.Tokens = + >; - (e.Errors) t.Pattern t.Unexpected e.Tokens = + s.Mode (e.Errors) t.Pattern t.Unexpected e.Tokens = (e.Errors ) (t.Pattern (/* пустой результат */) (/* нет блоков */)) t.Unexpected e.Tokens; @@ -338,44 +377,54 @@ Sentence-AfterExtensionChain { ExtensionChain = Result ":" (Block | Pattern ("," ExtensionChain | "=" Result)). - + == (e.Errors) (e.Conditions-And-SentenceTail) e.Tokens */ ExtensionChain { - e.Tokens = - >; + s.Mode e.Tokens = + >; } ExtensionChain-AfterResult { - (e.Errors) t.Result (TkColon t.ColonPos) (TkOpenBlock t.BlockPos) e.Tokens = + s.Mode (e.Errors) t.Result (TkRefal5Mode t.Pos s.NewMode) e.Tokens + = ; + + s.Mode (e.Errors) t.Result + (TkColon t.ColonPos) (TkRefal5Mode t.ModePos s.NewMode) e.Tokens + = ; + + s.Mode (e.Errors) t.Result + (TkColon t.ColonPos) (TkOpenBlock t.BlockPos) e.Tokens = + (e.Errors) t.Result >; - (e.Errors) t.Result t.NextToken e.Tokens, + s.Mode (e.Errors) t.Result t.NextToken e.Tokens, t.NextToken: { (TkColon t.Pos) = + s.Mode (e.Errors) t.Result >; (TkOpenBlock t.Pos) = + >; (TkSemicolon t.Pos) = (e.Errors (Error t.Pos 'Mistaken \',\' for \'=\'')) - (t.Result) (/* нет блоков */) + (t.Result (/* нет блоков */)) (TkSemicolon t.Pos) e.Tokens; (s.Type t.Pos), : True = + s.Mode (e.Errors (Error t.Pos 'Missed \':\'')) t.Result + >; t.Unexpected = @@ -392,33 +441,33 @@ ExtensionChain-AfterBlock { } ExtensionChain-AfterPattern { - (e.Errors) t.Result (e.PatternErrors) t.Pattern t.NextToken e.Tokens, + s.Mode (e.Errors) t.Result (e.PatternErrors) t.Pattern t.NextToken e.Tokens, t.NextToken: { (TkComma t.Pos) = + >; (TkAssign t.Pos) = + >; (TkColon t.Pos) = + >; (TkSemicolon t.Pos) = + >; t.Unexpected = @@ -457,20 +506,20 @@ ExtensionChain-AfterPattern-AfterResult { /* Pattern = Expression. - == (e.Errors) t.Pattern e.Tokens + == (e.Errors) t.Pattern e.Tokens */ Pattern { - e.Tokens = ; + s.Mode e.Tokens = ; } /* Result = Expression. - == (e.Errors) t.Result e.Tokens + == (e.Errors) t.Result e.Tokens */ Result { - e.Tokens = ; + s.Mode e.Tokens = ; } @@ -485,97 +534,102 @@ Result { | "" -- допустимо только в результатных выражениях )* !((")" | ">") Expression)* - == (e.Errors) t.Expression e.Tokens + == (e.Errors) t.Expression e.Tokens s.Kind ::= Pattern | Result */ Expression { - s.Kind e.Tokens = + s.Mode s.Kind e.Tokens = + s.Mode s.Kind >; } Expression-Aux { - s.Kind e.Tokens = - + s.Mode s.Kind e.Tokens = + } DoExpression { - s.Kind (e.Errors) (e.Collected) t.NextToken e.Tokens, + s.Mode s.Kind (e.Errors) (e.Collected) t.NextToken e.Tokens, t.NextToken: { (TkName t.Pos e.Name) = ; (TkCompound t.Pos e.Symbols) = ; (TkMacroDigit t.Pos s.Number) = ; (TkChar t.Pos s.Char) = ; (TkVariable t.Pos s.VarType e.Index) = ; (TkOpenBracket t.Pos) = + s.Mode s.Kind (e.Errors) + (e.Collected) >; (TkOpenCall t.Pos e.FuncName) = + s.Mode s.Kind (e.Errors) (e.Collected) t.Pos (e.FuncName) + >; + (TkRefal5Mode t.Pos s.NewMode) + = ; + t.OtherToken = (e.Errors) (e.Collected) t.OtherToken e.Tokens; } } DoExpression-AfterBracket { - s.Kind (e.Errors) (e.Collected) + s.Mode s.Kind (e.Errors) (e.Collected) (e.SubexprErrors) (e.BracketTerms) (TkCloseBracket t.Pos) e.Tokens = ; - s.Kind (e.Errors) (e.Collected) + s.Mode s.Kind (e.Errors) (e.Collected) (e.SubexprErrors) (e.BracketTerms) (s.Type t.Pos e.Value) e.Tokens = ; } DoExpression-AfterCall { - Result (e.Errors) (e.Collected) t.CallPos (e.FuncName) + s.Mode Result (e.Errors) (e.Collected) t.CallPos (e.FuncName) (e.SubexprErrors) (e.BracketTerms) (TkCloseCall t.Pos) e.Tokens = ; - Pattern (e.Errors) (e.Collected) t.CallPos (e.FuncName) + s.Mode Pattern (e.Errors) (e.Collected) t.CallPos (e.FuncName) (e.SubexprErrors) (e.BracketTerms) (TkCloseCall t.Pos) e.Tokens = ; - Result (e.Errors) (e.Collected) t.CallPos (e.FuncName) + s.Mode Result (e.Errors) (e.Collected) t.CallPos (e.FuncName) (e.SubexprErrors) (e.BracketTerms) (s.Type t.Pos e.Value) e.Tokens = \'')) + s.Mode Result (e.Errors e.SubexprErrors (Error t.Pos 'Missed \'>\'')) (e.Collected (CallBrackets (TkName t.CallPos e.FuncName) e.BracketTerms)) (s.Type t.Pos e.Value) e.Tokens >; - Pattern (e.Errors) (e.Collected) t.CallPos (e.FuncName) + s.Mode Pattern (e.Errors) (e.Collected) t.CallPos (e.FuncName) (e.SubexprErrors) (e.BracketTerms) (s.Type t.Pos e.Value) e.Tokens = : True = )) (e.Expression) - + >; - s.Kind (e.Errors) t.Expression e.Tokens = (e.Errors) t.Expression e.Tokens; + s.Mode s.Kind (e.Errors) t.Expression e.Tokens = + (e.Errors) t.Expression e.Tokens; } Expression-CheckBrackets-AfterSubexpr { - s.Kind (e.Errors) (e.Expression) + s.Mode s.Kind (e.Errors) (e.Expression) (e.SubexprErrors) (e.Subexpression) e.Tokens = ; } @@ -659,4 +715,5 @@ TokName { TkExtern = '$EXTERN'; TkEntry = '$ENTRY'; TkEOF = 'end of file'; + TkRefal5Mode = '*$CLASSIC or *$EXTENDED'; }