кое какие изменения по мелочи

This commit is contained in:
miks1965 2015-06-14 18:10:05 +03:00
parent 4318da4d50
commit 5f4ae3c7b5
21 changed files with 2223 additions and 2012 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "2";
public const string Minor = "2";
public const string Build = "0";
public const string Revision = "961";
public const string Revision = "965";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%MINOR%=2
%REVISION%=961
%REVISION%=965
%MAJOR%=2
%COREVERSION%=0

View file

@ -2,7 +2,7 @@
// This CSharp output file generated by Gardens Point LEX
// Version: 1.1.3.301
// Machine: SSM
// DateTime: 07.06.2015 8:49:49
// DateTime: 14.06.2015 0:11:32
// UserName: ?????????
// GPLEX input file <ABCPascal.lex>
// GPLEX frame file <embedded resource>
@ -957,6 +957,8 @@ string cur_yytext = yytext;
case (int)Tokens.tkUnit:
case (int)Tokens.tkLibrary:
case (int)Tokens.tkExternal:
case (int)Tokens.tkYield:
case (int)Tokens.tkSequence:
yylval = new Union();
yylval.ti = new token_info(cur_yytext,currentLexLocation);
break;
@ -1452,6 +1454,7 @@ public static class Keywords
keywords.Add("new",(int)Tokens.tkNew);
keywords.Add("auto",(int)Tokens.tkAuto);
keywords.Add("sequence",(int)Tokens.tkSequence);
keywords.Add("yield",(int)Tokens.tkYield);
}
public static int KeywordOrIDToken(string s)

View file

@ -344,6 +344,8 @@ ALPHABET [^ a-zA-Z_0-9\r\n\t\'$#&,:.;@\+\-\*/=<>\^()\[\]\x01]
case (int)Tokens.tkUnit:
case (int)Tokens.tkLibrary:
case (int)Tokens.tkExternal:
case (int)Tokens.tkYield:
case (int)Tokens.tkSequence:
yylval = new Union();
yylval.ti = new token_info(cur_yytext,currentLexLocation);
break;
@ -605,6 +607,7 @@ public static class Keywords
keywords.Add("new",(int)Tokens.tkNew);
keywords.Add("auto",(int)Tokens.tkAuto);
keywords.Add("sequence",(int)Tokens.tkSequence);
keywords.Add("yield",(int)Tokens.tkYield);
}
public static int KeywordOrIDToken(string s)

View file

@ -32,7 +32,7 @@
%token <ti> tkSizeOf tkTypeOf tkWhere tkArray tkCase tkClass tkAuto tkConst tkConstructor tkDestructor tkElse tkExcept tkFile tkFor tkForeach tkFunction
%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 tkPacked tkExports tkResourceString tkThreadvar tkSealed tkPartial tkTo tkDownto
%token <ti> tkCycle tkSequence
%token <ti> tkCycle tkSequence tkYield
%token <id> tkNew
%token <id> tkOn
%token <id> tkName tkPrivate tkProtected tkPublic tkInternal tkRead tkWrite
@ -81,7 +81,7 @@
%type <ob> for_cycle_type
%type <ex> format_expr
%type <stn> foreach_stmt
%type <stn> for_stmt
%type <stn> for_stmt yield_stmt
%type <stn> fp_list fp_sect_list
%type <td> file_type sequence_type
%type <stn> var_address
@ -2227,8 +2227,17 @@ unlabelled_stmt
{ $$ = $1; }
| my_stmt
{ $$ = $1; }
| yield_stmt
{ $$ = $1; }
;
yield_stmt
: tkYield expr_l1
{
$$ = new yield_node($2,@$);
}
;
my_stmt
: tkCycle expr unlabelled_stmt
{

File diff suppressed because it is too large Load diff

View file

@ -202,7 +202,6 @@
<name value="stmt_or_expression" />
<name value="stmt" />
<name value="unlabelled_stmt" />
<name value="my_stmt" />
<name value="var_stmt" />
<name value="assignment" />
<name value="proc_call" />

View file

@ -1,11 +1,9 @@
useLex=True
lex=ABCPascal.lex
yacc=ABCPascal.y
lexGen=D:\PascalABC.NET\!PABC_SVN1\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gplex.exe
yaccGen=D:\PascalABC.NET\!PABC_SVN1\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gppg.exe
lexGen=D:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\Gplex.exe
yaccGen=D:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gppg.exe
lexGenOpt=/unicode
yaccGenOpt=/gplex
useGenOpt=False
scriptWorkingDir=D:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin
script=
"D:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\GPLex_GPPG\gplex.exe" /unicode "D:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.lex"
@ -71,6 +69,8 @@ script=

View file

@ -1,5 +1,5 @@
cls
GPLex_GPPG\gplex.exe /unicode ABCPascal.lex
GPLex_GPPG\gppg.exe /no-lines /gplex /report ABCPascal.y
GPLex_GPPG\gppg.exe /no-lines /gplex ABCPascal.y
convert4.exe
pause

View file

@ -1 +1 @@
!define VERSION '2.2.0.961'
!define VERSION '2.2.0.965'

View file

@ -864,6 +864,10 @@ namespace PascalABCCompiler.SyntaxTree
public virtual void visit(modern_proc_type _modern_proc_type)
{
}
public virtual void visit(yield_node _yield_node)
{
}
}

View file

@ -1725,6 +1725,14 @@ namespace PascalABCCompiler.SyntaxTree
{
}
public virtual void pre_do_visit(yield_node _yield_node)
{
}
public virtual void post_do_visit(yield_node _yield_node)
{
}
public override void visit(syntax_tree_node _syntax_tree_node)
{
pre_do_visit(_syntax_tree_node);
@ -3363,6 +3371,13 @@ namespace PascalABCCompiler.SyntaxTree
visit(modern_proc_type.res);
post_do_visit(_modern_proc_type);
}
public override void visit(yield_node _yield_node)
{
pre_do_visit(_yield_node);
visit(yield_node.ex);
post_do_visit(_yield_node);
}
}

View file

@ -450,6 +450,8 @@ namespace PascalABCCompiler.SyntaxTree
return new sequence_type();
case 214:
return new modern_proc_type();
case 215:
return new yield_node();
}
return null;
}
@ -3821,6 +3823,18 @@ namespace PascalABCCompiler.SyntaxTree
_modern_proc_type.res = _read_node() as type_definition;
}
public void visit(yield_node _yield_node)
{
read_yield_node(_yield_node);
}
public void read_yield_node(yield_node _yield_node)
{
read_statement(_yield_node);
_yield_node.ex = _read_node() as expression;
}
}

View file

@ -6056,6 +6056,27 @@ namespace PascalABCCompiler.SyntaxTree
}
}
public void visit(yield_node _yield_node)
{
bw.Write((Int16)215);
write_yield_node(_yield_node);
}
public void write_yield_node(yield_node _yield_node)
{
write_statement(_yield_node);
if (_yield_node.ex == null)
{
bw.Write((byte)0);
}
else
{
bw.Write((byte)1);
_yield_node.ex.visit(this);
}
}
}

View file

@ -3818,11 +3818,6 @@ namespace PascalABCCompiler.SyntaxTree
}
public override string ToString()
{
return "while " + expr.ToString() + " do\n" + statements.ToString();
}
///<summary>
///Свойство для получения количества всех подузлов. Подузлом также считается каждый элемент поля типа List
///</summary>
@ -4666,7 +4661,7 @@ namespace PascalABCCompiler.SyntaxTree
public override string ToString()
{
return "label "+labels.ToString();
return "label "+labels.ToString() + ";";
}
///<summary>
@ -8943,6 +8938,20 @@ namespace PascalABCCompiler.SyntaxTree
}
public goto_statement(string name)
{
label = new ident(name);
}
public goto_statement(string name, SourceContext sc)
{
label = new ident(name);
source_context = sc;
}
public override string ToString()
{
return "goto " + label;
}
///<summary>
///Свойство для получения количества всех подузлов. Подузлом также считается каждый элемент поля типа List
///</summary>
@ -9062,9 +9071,16 @@ namespace PascalABCCompiler.SyntaxTree
}
public override string ToString()
public labeled_statement(string name, statement st)
{
return label_name.ToString() + ": "+to_statement.ToString();
label_name = new ident(name);
to_statement = st;
}
public labeled_statement(string name, statement st, SourceContext sc)
{
label_name = new ident(name);
to_statement = st;
source_context = sc;
}
///<summary>
@ -28463,6 +28479,112 @@ namespace PascalABCCompiler.SyntaxTree
}
///<summary>
///
///</summary>
[Serializable]
public class yield_node : statement
{
///<summary>
///Конструктор без параметров.
///</summary>
public yield_node()
{
}
///<summary>
///Конструктор с параметрами.
///</summary>
public yield_node(expression _ex)
{
this._ex=_ex;
}
///<summary>
///Конструктор с параметрами.
///</summary>
public yield_node(expression _ex,SourceContext sc)
{
this._ex=_ex;
source_context = sc;
}
protected expression _ex;
///<summary>
///
///</summary>
public expression ex
{
get
{
return _ex;
}
set
{
_ex=value;
}
}
public override string ToString()
{
return "yield "+ex.ToString();
}
///<summary>
///Свойство для получения количества всех подузлов. Подузлом также считается каждый элемент поля типа List
///</summary>
public override Int32 subnodes_count
{
get
{
return 1;
}
}
///<summary>
///Индексатор для получения всех подузлов
///</summary>
public override object this[Int32 ind]
{
get
{
if(subnodes_count == 0 || ind < 0 || ind > subnodes_count-1)
throw new IndexOutOfRangeException();
switch(ind)
{
case 0:
return ex;
}
return null;
}
set
{
if(subnodes_count == 0 || ind < 0 || ind > subnodes_count-1)
throw new IndexOutOfRangeException();
switch(ind)
{
case 0:
ex = (expression)value;
break;
}
}
}
///<summary>
///Метод для обхода дерева посетителем
///</summary>
///<param name="visitor">Объект-посетитель.</param>
///<returns>Return value is void</returns>
public override void visit(IVisitor visitor)
{
visitor.visit(this);
}
}
}

View file

@ -1294,6 +1294,12 @@ namespace PascalABCCompiler.SyntaxTree
///<param name="_modern_proc_type">Node to visit</param>
///<returns> Return value is void </returns>
void visit(modern_proc_type _modern_proc_type);
///<summary>
///Method to visit yield_node.
///</summary>
///<param name="_yield_node">Node to visit</param>
///<returns> Return value is void </returns>
void visit(yield_node _yield_node);
}

Binary file not shown.

View file

@ -671,7 +671,7 @@ namespace PascalABCCompiler.TreeConverter
convertion_data_and_alghoritms.check_node_parser_error(st);
st = prepare_statement(st);
//st = prepare_statement(st);
statement_node sn = ret.visit(st);
//sn.loc=get_location(st);
@ -742,7 +742,7 @@ namespace PascalABCCompiler.TreeConverter
}*/
//(ssyy) DS, сделай нормальное дерево! // 2015 год - проблема по-прежнему актуальна: expression не должно быть потомком statement
private SyntaxTree.statement prepare_statement(SyntaxTree.statement st) // логика: если это вызов функции, то сделать из него вызов процедуры. И это - единственное место для преобразования
/*private SyntaxTree.statement prepare_statement(SyntaxTree.statement st) // логика: если это вызов функции, то сделать из него вызов процедуры. И это - единственное место для преобразования
{
SyntaxTree.method_call mc = null; // st as SyntaxTree.method_call;
if (mc == null)
@ -753,7 +753,7 @@ namespace PascalABCCompiler.TreeConverter
{
return new SyntaxTree.procedure_call(mc);
}
}
} */
internal statement_node convert_strong(SyntaxTree.statement st)
{
@ -779,7 +779,7 @@ namespace PascalABCCompiler.TreeConverter
convertion_data_and_alghoritms.check_node_parser_error(st);
st = prepare_statement(st);
//st = prepare_statement(st);
statement_node sn = null;
//try
{

View file

@ -50,6 +50,7 @@
<Key word = "in" />
<Key word = "array" />
<Key word = "sequence" />
<Key word = "yield" />
<Key word = "case" />
<Key word = "class" />
<Key word = "auto" />

Binary file not shown.