From 33065bc6375c04824df672254d80e0655aed487d 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: Wed, 3 Apr 2019 18:57:13 +0300 Subject: [PATCH] =?UTF-8?q?=D0=90=D0=B4=D0=B0=D0=BF=D1=82=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B4=D0=B5=D1=80=D0=B5=D0=B2=D0=B0=20=D0=BA?= =?UTF-8?q?=C2=A0=D0=A0=D0=B5=D1=84=D0=B0=D0=BB=D1=83-05=20(#5,=20Mazdaywi?= =?UTF-8?q?k/Refal-05#33)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/Refal5-AST.md | 11 ++++++----- lib/Refal5-AST.ref | 8 ++++---- lib/Refal5-Parser.ref | 10 +++++----- lib/Refal5-Plainer.ref | 14 +++++++------- lib/Refal5-Transformer.ref | 15 +++------------ 5 files changed, 25 insertions(+), 33 deletions(-) diff --git a/docs/Refal5-AST.md b/docs/Refal5-AST.md index ef9e632..39f37d8 100644 --- a/docs/Refal5-AST.md +++ b/docs/Refal5-AST.md @@ -20,9 +20,9 @@ t.Pattern, t.Result ::= (t.Term*) t.Term ::= - (Compound e.Chars*) - | (Number s.Number) - | (Char s.Char) + (Symbol Word t.SrcPos e.Chars*) + | (Symbol Number s.Number) + | (Symbol Char s.Char) | (Variable t.SrcPos s.VarType e.Index) | (Brackets t.Term*) | (Call t.SrcPos (e.Function) t.Terms*) @@ -43,8 +43,9 @@ частью (`RETURN`), либо вызовом блока (`CALL-BLOCK`). * `t.Result` — результатное выражение. * `t.Term` — терм выражения, может быть: - - `Compound` — словом (составным символом), - - `Number` — макроцифрой, + - `Symbol Word` — словом (составным символом), + - `Symbol Number` — макроцифрой, + - `Symbol Char` — литерой, - `Variable` — переменной, - `Brackets` — скобочным термом, - `Call` — вызовом функции (недопустим внутри образца). diff --git a/lib/Refal5-AST.ref b/lib/Refal5-AST.ref index a34f8ef..ca3f880 100644 --- a/lib/Refal5-AST.ref +++ b/lib/Refal5-AST.ref @@ -11,9 +11,9 @@ t.Pattern, t.Result ::= (t.Term*) t.Term ::= - (Compound e.Chars*) - | (Number s.Number) - | (Char s.Char) + (Symbol Word t.SrcPos e.Chars*) + | (Symbol Number s.Number) + | (Symbol Char s.Char) | (Variable t.SrcPos s.VarType e.Index) | (Brackets t.Term*) | (Call t.SrcPos (e.Function) t.Terms*) @@ -22,7 +22,7 @@ *$EENUM SpecialComment, Extern, Function, Entry, Local *$EENUM RETURN, CALL-BLOCK, Condition -*$EENUM Compound, Number, Char, Variable, Brackets, Call +*$EENUM Symbol, Word, Number, Char, Variable, Brackets, Call /** diff --git a/lib/Refal5-Parser.ref b/lib/Refal5-Parser.ref index 83cbf9b..bd78e7c 100644 --- a/lib/Refal5-Parser.ref +++ b/lib/Refal5-Parser.ref @@ -12,7 +12,7 @@ $EXTERN OneOf, Map; $EXTERN Builtins; *$EXTERN SpecialComment, Extern, Function, Entry, Local *$EXTERN RETURN, CALL-BLOCK, Condition -*$EXTERN Compound, Number, Char, Variable, Brackets, Call +*$EXTERN Symbol, Word, Number, Char, Variable, Brackets, Call *$FROM Library @@ -483,22 +483,22 @@ DoExpression { { (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) = diff --git a/lib/Refal5-Plainer.ref b/lib/Refal5-Plainer.ref index 613c317..c0279b4 100644 --- a/lib/Refal5-Plainer.ref +++ b/lib/Refal5-Plainer.ref @@ -1,6 +1,6 @@ *$FROM Refal5-AST *$EXTERN Extern, Function, SpecialComment, Entry, Local, RETURN, Condition -*$EXTERN CALL-BLOCK, Brackets, Call, Compound, Number, Char, Variable +*$EXTERN CALL-BLOCK, Brackets, Call, Symbol, Word, Number, Char, Variable *$FROM Library *$EXTERN False, True @@ -218,7 +218,7 @@ AppendTerm { } InlineTerm { - (s.Type e.Value) = ; + (s.Type e.Value) = ; ';' = ';'; } @@ -247,14 +247,14 @@ MultilineTerm-Prefix { (e.Indent '>' e.Suffix); (s.Type e.Value) - = (e.Prefix e.Suffix); + = (e.Prefix e.Suffix); }; } -PlainByType { - Compound e.Chars = ; - Number s.Number = ; - Char s.Char = ; +PlainTerm { + Symbol Word t.SrcPos e.Chars = ; + Symbol Number s.Number = ; + Symbol Char s.Char = ; Variable t.SrcPos s.Type e.Index = ; Call t.SrcPos (e.Function) e.Arg = ; Brackets e.Expr = ; diff --git a/lib/Refal5-Transformer.ref b/lib/Refal5-Transformer.ref index deb47c0..a5dbfa5 100644 --- a/lib/Refal5-Transformer.ref +++ b/lib/Refal5-Transformer.ref @@ -5,7 +5,7 @@ $EXTERN Map, Unique; *$FROM Refal5-AST $EXTERN Builtins; *$EXTERN Function, Extern, SpecialComment, CALL-BLOCK, RETURN, Call, Local -*$EXTERN Condition, Brackets, Variable, Compound, Number, Char +*$EXTERN Condition, Brackets, Variable, Symbol, Word, Number, Char *$FROM Library *$EXTERN True, False @@ -402,9 +402,7 @@ DoPatternSteps { } HardItem { - (e.BoundEVariables) (Compound e.Compound) = True; - (e.BoundEVariables) (Number s.Number) = True; - (e.BoundEVariables) (Char s.Char) = True; + (e.BoundEVariables) (Symbol s.Type e.Info) = True; (e.BoundEVariables) (Variable t.SrcPos 's' e.Index) = True; (e.BoundEVariables) (Variable t.SrcPos 't' e.Index) = True; @@ -422,7 +420,7 @@ $ENTRY transformer_BindBrackets { DoBindBrackets { (t.MultiBracket e.Scanned) t.Symbol e.Tail - , : True + , t.Symbol : (Symbol s.Type e.Info) = ; (t.MultiBracket e.Scanned) (Variable t.SrcPos s.Type e.Index) e.Tail @@ -818,10 +816,3 @@ DoNewName { e.Names = ((e.NewName) e.Names) e.NewName; }; } - -Symbol { - (Compound e.Chars) = True; - (Number s.Number) = True; - (Char s.Char) = True; - t.Other = False; -}