первая версия async в грамматике

This commit is contained in:
Mikhalkovich Stanislav 2023-12-08 19:37:39 +03:00
parent d93371d03c
commit 771e1f799c
14 changed files with 3001 additions and 2860 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "9";
public const string Build = "0";
public const string Revision = "3386";
public const string Revision = "3389";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%COREVERSION%=0
%REVISION%=3386
%MINOR%=9
%REVISION%=3389
%COREVERSION%=0
%MAJOR%=3

View file

@ -2,7 +2,7 @@
// This CSharp output file generated by Gardens Point LEX
// Version: 1.1.3.301
// Machine: DESKTOP-G8V08V4
// DateTime: 13.09.2023 10:23:20
// DateTime: 08.12.2023 19:18:25
// UserName: ?????????
// GPLEX input file <ABCPascal.lex>
// GPLEX frame file <embedded resource>
@ -1979,6 +1979,8 @@ string cur_yytext = yytext;
case (int)Tokens.tkWhen:
case (int)Tokens.tkStatic:
case (int)Tokens.tkStep:
case (int)Tokens.tkAsync:
case (int)Tokens.tkAwait:
yylval = new Union();
yylval.ti = new token_info(cur_yytext,currentLexLocation);
break;

View file

@ -391,6 +391,8 @@ UNICODEARROW \x890
case (int)Tokens.tkWhen:
case (int)Tokens.tkStatic:
case (int)Tokens.tkStep:
case (int)Tokens.tkAsync:
case (int)Tokens.tkAwait:
yylval = new Union();
yylval.ti = new token_info(cur_yytext,currentLexLocation);
break;
@ -582,4 +584,4 @@ UNICODEARROW \x890
}
}
// Статический класс, определяющий ключевые слова языка, находится в файле Keywords.cs
// Статический класс, определяющий ключевые слова языка, находится в файле Keywords.cs

View file

@ -34,7 +34,7 @@
%start parse_goal
%token <ti> tkDirectiveName tkAmpersend tkColon tkDotDot tkPoint tkRoundOpen tkRoundClose tkSemiColon tkSquareOpen tkSquareClose tkQuestion tkUnderscore tkQuestionPoint tkDoubleQuestion tkQuestionSquareOpen
%token <ti> tkBackSlashRoundOpen
%token <ti> tkBackSlashRoundOpen tkAsync tkAwait
%token <ti> tkSizeOf tkTypeOf tkWhere tkArray tkCase tkClass tkAuto tkStatic tkConst tkConstructor tkDestructor tkElse tkExcept tkFile tkFor tkForeach tkFunction tkMatch tkWhen
%token <ti> tkIf tkImplementation tkInherited tkInterface tkProcedure tkOperator tkProperty tkRaise tkRecord tkSet tkType tkThen tkUses tkVar tkWhile tkWith tkNil
%token <ti> tkGoto tkOf tkLabel tkLock tkProgram tkEvent tkDefault tkTemplate tkExports tkResourceString tkThreadvar tkSealed tkPartial tkTo tkDownto
@ -57,7 +57,7 @@
%token <id> tkUnknown
%token <ti> tkStep
%type <ti> unit_key_word class_or_static
%type <ti> unit_key_word class_or_static
%type <stn> assignment
%type <stn> optional_array_initializer
%type <stn> attribute_declarations
@ -2383,6 +2383,23 @@ proc_func_decl
($2 as procedure_definition).proc_header.class_keyword = true;
$$ = $2;
}
| tkAsync proc_func_decl_noclass
{
($2 as procedure_definition).proc_header.IsAsync = true;
$$ = $2;
}
| tkAsync class_or_static proc_func_decl_noclass
{
($3 as procedure_definition).proc_header.IsAsync = true;
($3 as procedure_definition).proc_header.class_keyword = true;
$$ = $3;
}
| class_or_static tkAsync proc_func_decl_noclass
{
($3 as procedure_definition).proc_header.IsAsync = true;
($3 as procedure_definition).proc_header.class_keyword = true;
$$ = $3;
}
;
proc_func_decl_noclass
@ -2431,12 +2448,37 @@ inclass_proc_func_decl
{
$$ = $1;
}
| tkAsync inclass_proc_func_decl_noclass
{
($2 as procedure_definition).proc_header.IsAsync = true;
$$ = $2;
}
| class_or_static inclass_proc_func_decl_noclass
{
if (($2 as procedure_definition).proc_header != null)
{
($2 as procedure_definition).proc_header.class_keyword = true;
}
$$ = $2;
}
| tkAsync class_or_static inclass_proc_func_decl_noclass
{
if (($3 as procedure_definition).proc_header != null)
{
($3 as procedure_definition).proc_header.IsAsync = true;
($3 as procedure_definition).proc_header.class_keyword = true;
}
$$ = $3;
}
| class_or_static tkAsync inclass_proc_func_decl_noclass
{
if (($3 as procedure_definition).proc_header != null)
{
($3 as procedure_definition).proc_header.IsAsync = true;
($3 as procedure_definition).proc_header.class_keyword = true;
}
$$ = $3;
}
;
inclass_proc_func_decl_noclass

File diff suppressed because it is too large Load diff

View file

@ -146,6 +146,8 @@ namespace GPPGParserScanner
keywords.Add(Convert("static"), (int)Tokens.tkStatic);
keywords.Add(Convert("step"), (int)Tokens.tkStep);
keywords.Add(Convert("index"), (int)Tokens.tkIndex);
keywords.Add(Convert("async"), (int)Tokens.tkAsync);
keywords.Add(Convert("await"), (int)Tokens.tkAwait);
}
static Keywords()

View file

@ -369,5 +369,6 @@ script=

View file

@ -1 +1 @@
3.9.0.3386
3.9.0.3389

View file

@ -1 +1 @@
!define VERSION '3.9.0.3386'
!define VERSION '3.9.0.3389'

View file

@ -741,6 +741,7 @@ namespace PascalABCCompiler.SyntaxTree
// frninja 20/05/16 - для методов хелперов yield
public bool is_yield_helper = false;
// end frninja
public bool IsAsync { get; set; } = false;
public procedure_header(formal_parameters _parameters, procedure_attributes_list _proc_attributes, method_name _name, where_definition_list _where_defs, SourceContext sc)
{
@ -2090,6 +2091,19 @@ namespace PascalABCCompiler.SyntaxTree
public bool IsDataClass { get ; set; }
}
public partial class procedure_definition
{
/*public procedure_definition(procedure_header _proc_header, proc_block _proc_body,
bool _is_short_definition)
{
this._proc_header = _proc_header;
this._proc_body = _proc_body;
this._is_short_definition = _is_short_definition;
FillParentsInDirectChilds();
}*/
}
public class semantic_check_delegates_pointers_in_cached_function // класс - маркер семантической проверки
{ }
}

View file

@ -300,7 +300,8 @@ namespace VisualPascalABCPlugins
{
if (_procedure_header.of_object) text+="of object";
if (_procedure_header.class_keyword) text+="class proc";
}
if (_procedure_header.IsAsync) text += "isAsync";
}
public override void visit(function_header _function_header)

View file

@ -34,12 +34,18 @@ namespace VisualPascalABCPlugins
tn.Text=text;
tn.Tag=subnode;
string s=get_node_info.node(subnode);
if (s!=null)
{
tn.Text+=" "+s;
}
//tn.Nodes.Clear();
visualizator vs=new visualizator(tn.Nodes);
//get_async_info.node(subnode);
//if (s!=null)
//{
// if (s.EndsWith("Async"))
// tn.Text += " " + s + " ASYNCcount =" + get_async_info.AsyncCount;
// else
// tn.Text += " " + s;
// }
tn.Text += " " + s;
//tn.Nodes.Clear();
visualizator vs=new visualizator(tn.Nodes);
subnode.visit(vs);
nodes.Add(tn);
}

View file

@ -111,6 +111,8 @@
<Key word = "where" />
<Key word = "match" />
<Key word = "when" />
<Key word = "async" />
<Key word = "await" />
</KeyWords>