Add keywords to parser
This commit is contained in:
parent
5bed9fa995
commit
8be0622eeb
|
|
@ -2,7 +2,7 @@
|
|||
// This CSharp output file generated by Gardens Point LEX
|
||||
// Version: 1.1.3.301
|
||||
// Machine: ALEXANDER-PC
|
||||
// DateTime: 11.05.2018 18:06:46
|
||||
// DateTime: 12.05.2018 15:47:47
|
||||
// UserName: Alexander
|
||||
// GPLEX input file <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
|
|
|
|||
|
|
@ -3716,6 +3716,10 @@ keyword
|
|||
{ $$ = $1; }
|
||||
| tkYield
|
||||
{ $$ = $1; }
|
||||
| tkMatch
|
||||
{ $$ = $1; }
|
||||
| tkWhen
|
||||
{ $$ = $1; }
|
||||
;
|
||||
|
||||
reserved_keyword
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
37
Patterns/Desugaring-v3.pas
Normal file
37
Patterns/Desugaring-v3.pas
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
// Source
|
||||
|
||||
match x with
|
||||
My(string(s), integer(t)) when s = 'asd':
|
||||
end
|
||||
|
||||
// Desugared code (match, 1st stage)
|
||||
|
||||
var <>matchDone := false;
|
||||
var <>genVarExpr := x;
|
||||
if not matchDone and <>genVarExpr is My(string(s), integer(t)) then
|
||||
begin
|
||||
if s = 'asd' then
|
||||
begin
|
||||
<>match1Done := true;
|
||||
<ACTION>
|
||||
end;
|
||||
end;
|
||||
|
||||
// Desugared code (is, 2nd stage)
|
||||
|
||||
var <>matchDone := false;
|
||||
var <>genVarExpr := x;
|
||||
var <>genVar1: My;
|
||||
|
||||
if IsTest(<>genVarExpr, <>genVar1) then
|
||||
var s: string;
|
||||
var t: integer;
|
||||
|
||||
if <>genVarExpr is My(string(s), integer(t)) then
|
||||
begin
|
||||
if s = 'asd' then
|
||||
begin
|
||||
<>match1Done := true;
|
||||
<ACTION>
|
||||
end;
|
||||
end;
|
||||
Loading…
Reference in a new issue