This commit is contained in:
parent
d8f195656c
commit
6ccd4448d4
|
|
@ -68,15 +68,8 @@ namespace CodeCompletion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal compilation_unit ParsersControllerGetComilationUnit(string FileName, string Text, List<Error> ErrorsList, bool partParse)
|
internal compilation_unit ParsersControllerGetCompilationUnit(string FileName, string Text, List<Error> ErrorsList)
|
||||||
{
|
{
|
||||||
string fnpart = FileName + "part" + PascalABCCompiler.Parsers.Controller.HideParserExtensionPostfixChar;
|
|
||||||
if (partParse)
|
|
||||||
if (ParsersController.ParserExists(".paspart_"))
|
|
||||||
{
|
|
||||||
if (!comp.InternalDebug.UseStandarParserForIntellisense)
|
|
||||||
FileName = fnpart;
|
|
||||||
}
|
|
||||||
string ext = Path.GetExtension(FileName);
|
string ext = Path.GetExtension(FileName);
|
||||||
Parser = ParsersController.selectParser(ext.ToLower());
|
Parser = ParsersController.selectParser(ext.ToLower());
|
||||||
parsers[ext] = Parser;
|
parsers[ext] = Parser;
|
||||||
|
|
@ -86,7 +79,7 @@ namespace CodeCompletion
|
||||||
return cu;
|
return cu;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal compilation_unit ParsersControllerGetComilationUnitSpecial(string FileName, string Text, List<Error> ErrorsList, bool partParse)
|
internal compilation_unit ParsersControllerGetCompilationUnitSpecial(string FileName, string Text, List<Error> ErrorsList)
|
||||||
{
|
{
|
||||||
string ext = Path.GetExtension(FileName);
|
string ext = Path.GetExtension(FileName);
|
||||||
Parser = ParsersController.selectParser(ext.ToLower());
|
Parser = ParsersController.selectParser(ext.ToLower());
|
||||||
|
|
@ -106,7 +99,7 @@ namespace CodeCompletion
|
||||||
string ext = Path.GetExtension(FileName);
|
string ext = Path.GetExtension(FileName);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cu = ParsersControllerGetComilationUnit(FileName, Text, ErrorsList, true);
|
cu = ParsersControllerGetCompilationUnit(FileName, Text, ErrorsList);
|
||||||
ErrorsList.Clear();
|
ErrorsList.Clear();
|
||||||
PascalABCCompiler.SyntaxTree.documentation_comment_list dt = ParsersController.Compile(System.IO.Path.ChangeExtension(FileName, get_doctagsParserExtension(ext)), Text/*+")))));end."*/, ErrorsList, PascalABCCompiler.Parsers.ParseMode.Normal) as PascalABCCompiler.SyntaxTree.documentation_comment_list;
|
PascalABCCompiler.SyntaxTree.documentation_comment_list dt = ParsersController.Compile(System.IO.Path.ChangeExtension(FileName, get_doctagsParserExtension(ext)), Text/*+")))));end."*/, ErrorsList, PascalABCCompiler.Parsers.ParseMode.Normal) as PascalABCCompiler.SyntaxTree.documentation_comment_list;
|
||||||
PascalABCCompiler.DocumentationConstructor docconst = new PascalABCCompiler.DocumentationConstructor();
|
PascalABCCompiler.DocumentationConstructor docconst = new PascalABCCompiler.DocumentationConstructor();
|
||||||
|
|
@ -134,7 +127,7 @@ namespace CodeCompletion
|
||||||
string tmp = ParsersHelper.GetModifiedProgramm(Text);
|
string tmp = ParsersHelper.GetModifiedProgramm(Text);
|
||||||
if (tmp != null)
|
if (tmp != null)
|
||||||
{
|
{
|
||||||
cu = ParsersControllerGetComilationUnitSpecial(FileName, tmp, ErrorsList, true);
|
cu = ParsersControllerGetCompilationUnitSpecial(FileName, tmp, ErrorsList);
|
||||||
}
|
}
|
||||||
if (comp_modules[FileName] == null)
|
if (comp_modules[FileName] == null)
|
||||||
{
|
{
|
||||||
|
|
@ -162,45 +155,40 @@ namespace CodeCompletion
|
||||||
return dconv;
|
return dconv;
|
||||||
//ConvertToDom(cu);
|
//ConvertToDom(cu);
|
||||||
}
|
}
|
||||||
|
|
||||||
//vremenno, potom ubrat
|
//vremenno, potom ubrat
|
||||||
private compilation_unit get_fictive_unit(string s, string FileName)
|
private compilation_unit get_fictive_unit(string s, string FileName)
|
||||||
{
|
{
|
||||||
program_module prog = new program_module();
|
program_module prog = new program_module();
|
||||||
int line = 1;
|
int line = 1;
|
||||||
int col = 1;
|
int col = 1;
|
||||||
for (int i=0; i<s.Length; i++)
|
for (int i = 0; i < s.Length; i++)
|
||||||
if (s[i] == '\n')
|
if (s[i] == '\n')
|
||||||
{
|
{
|
||||||
line++;
|
line++;
|
||||||
col = 1;
|
col = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
col++;
|
col++;
|
||||||
}
|
}
|
||||||
prog.source_context = new SourceContext(1,1,line+3,3);
|
prog.source_context = new SourceContext(1, 1, line + 3, 3);
|
||||||
prog.program_block = new block();
|
prog.program_block = new block();
|
||||||
prog.file_name = FileName;
|
prog.file_name = FileName;
|
||||||
statement_list sl = new statement_list();
|
statement_list sl = new statement_list();
|
||||||
prog.program_block.program_code = sl;
|
prog.program_block.program_code = sl;
|
||||||
prog.program_block.program_code.left_logical_bracket = new token_info("begin");
|
prog.program_block.program_code.left_logical_bracket = new token_info("begin");
|
||||||
prog.program_block.program_code.left_logical_bracket.source_context = new SourceContext(1,1,1,5);
|
prog.program_block.program_code.left_logical_bracket.source_context = new SourceContext(1, 1, 1, 5);
|
||||||
prog.program_block.program_code.right_logical_bracket = new token_info("end");
|
prog.program_block.program_code.right_logical_bracket = new token_info("end");
|
||||||
prog.program_block.program_code.right_logical_bracket.source_context = new SourceContext(line+3,1,line+3,3);
|
prog.program_block.program_code.right_logical_bracket.source_context = new SourceContext(line + 3, 1, line + 3, 3);
|
||||||
sl.subnodes.Add(new empty_statement());
|
sl.subnodes.Add(new empty_statement());
|
||||||
return prog;
|
return prog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PascalABCCompiler.SyntaxTree.compilation_unit ParseOnlySyntaxTree(string FileName, string Text)
|
public PascalABCCompiler.SyntaxTree.compilation_unit ParseOnlySyntaxTree(string FileName, string Text)
|
||||||
{
|
{
|
||||||
List<PascalABCCompiler.Errors.Error> ErrorsList = new List<PascalABCCompiler.Errors.Error>();
|
List<PascalABCCompiler.Errors.Error> ErrorsList = new List<PascalABCCompiler.Errors.Error>();
|
||||||
PascalABCCompiler.SyntaxTree.compilation_unit cu = ParsersControllerGetComilationUnit(FileName, Text, ErrorsList, false);
|
PascalABCCompiler.SyntaxTree.compilation_unit cu = ParsersControllerGetCompilationUnit(FileName, Text, ErrorsList);
|
||||||
if (cu == null)
|
|
||||||
{
|
|
||||||
ErrorsList.Clear();
|
|
||||||
cu = ParsersControllerGetComilationUnit(FileName, Text, ErrorsList, true);
|
|
||||||
}
|
|
||||||
return cu;
|
return cu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -236,7 +224,7 @@ namespace CodeCompletion
|
||||||
string tmp = ParsersHelper.GetModifiedProgramm(Text);
|
string tmp = ParsersHelper.GetModifiedProgramm(Text);
|
||||||
if (tmp != null)
|
if (tmp != null)
|
||||||
{
|
{
|
||||||
cu = ParsersControllerGetComilationUnitSpecial(FileName, tmp, ErrorsList, true);
|
cu = ParsersControllerGetCompilationUnitSpecial(FileName, tmp, ErrorsList);
|
||||||
ErrorsList.Clear();
|
ErrorsList.Clear();
|
||||||
}
|
}
|
||||||
if (cu == null)
|
if (cu == null)
|
||||||
|
|
@ -264,8 +252,6 @@ namespace CodeCompletion
|
||||||
return dconv;
|
return dconv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public DomConverter CompileAllIfNeed(string FileName, bool parse_only_interface=false)
|
public DomConverter CompileAllIfNeed(string FileName, bool parse_only_interface=false)
|
||||||
{
|
{
|
||||||
this.FileName = FileName;
|
this.FileName = FileName;
|
||||||
|
|
@ -300,7 +286,7 @@ namespace CodeCompletion
|
||||||
string tmp = ParsersHelper.GetModifiedProgramm(Text);
|
string tmp = ParsersHelper.GetModifiedProgramm(Text);
|
||||||
if (tmp != null)
|
if (tmp != null)
|
||||||
{
|
{
|
||||||
cu = ParsersControllerGetComilationUnitSpecial(FileName, tmp, ErrorsList, true);
|
cu = ParsersControllerGetCompilationUnitSpecial(FileName, tmp, ErrorsList);
|
||||||
ErrorsList.Clear();
|
ErrorsList.Clear();
|
||||||
}
|
}
|
||||||
if (cu == null)
|
if (cu == null)
|
||||||
|
|
|
||||||
|
|
@ -2743,10 +2743,10 @@ namespace PascalABCCompiler
|
||||||
return cu;
|
return cu;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SyntaxTree.compilation_unit InternalParseText(string FileName, string Text, List<Error> ErrorList)
|
private SyntaxTree.compilation_unit InternalParseText(string FileName, string Text, List<Error> ErrorList, List<string> DefinesList = null)
|
||||||
{
|
{
|
||||||
OnChangeCompilerState(this, CompilerState.BeginParsingFile, FileName);
|
OnChangeCompilerState(this, CompilerState.BeginParsingFile, FileName);
|
||||||
SyntaxTree.compilation_unit cu = ParsersController.GetCompilationUnit(FileName, Text, ErrorsList);
|
SyntaxTree.compilation_unit cu = ParsersController.GetCompilationUnit(FileName, Text, ErrorsList, DefinesList);
|
||||||
OnChangeCompilerState(this, CompilerState.EndParsingFile, FileName);
|
OnChangeCompilerState(this, CompilerState.EndParsingFile, FileName);
|
||||||
//Вычисляем сколько строк скомпилировали
|
//Вычисляем сколько строк скомпилировали
|
||||||
if (ErrorList.Count == 0 && cu != null && cu.source_context!=null)
|
if (ErrorList.Count == 0 && cu != null && cu.source_context!=null)
|
||||||
|
|
@ -2893,8 +2893,12 @@ namespace PascalABCCompiler
|
||||||
throw new SourceFileNotFound(UnitName);
|
throw new SourceFileNotFound(UnitName);
|
||||||
else
|
else
|
||||||
throw new UnitNotFound(CurrentCompilationUnit.SyntaxTree.file_name, UnitName, SyntaxUsesUnit.source_context);
|
throw new UnitNotFound(CurrentCompilationUnit.SyntaxTree.file_name, UnitName, SyntaxUsesUnit.source_context);
|
||||||
|
List<string> DefinesList = new List<string>();
|
||||||
CurrentUnit.SyntaxTree = InternalParseText(UnitName, SourceText, errorsList);
|
if (!compilerOptions.Debug && !compilerOptions.ForDebugging)
|
||||||
|
DefinesList.Add("RELEASE");
|
||||||
|
else
|
||||||
|
DefinesList.Add("DEBUG");
|
||||||
|
CurrentUnit.SyntaxTree = InternalParseText(UnitName, SourceText, errorsList, DefinesList);
|
||||||
|
|
||||||
if (errorsList.Count == 0) // SSM 2/05/16 - для преобразования синтаксических деревьев извне
|
if (errorsList.Count == 0) // SSM 2/05/16 - для преобразования синтаксических деревьев извне
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ namespace PascalABCCompiler.Parsers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual PascalABCCompiler.SyntaxTree.syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode)
|
public virtual PascalABCCompiler.SyntaxTree.syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode, List<string> DefinesList = null)
|
||||||
{
|
{
|
||||||
syntax_tree_node root = null;
|
syntax_tree_node root = null;
|
||||||
|
|
||||||
|
|
@ -146,7 +146,7 @@ namespace PascalABCCompiler.Parsers
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual syntax_tree_node BuildTreeInNormalMode(string FileName, string Text)
|
public virtual syntax_tree_node BuildTreeInNormalMode(string FileName, string Text, List<string> DefinesList = null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ namespace PascalABCCompiler.Parsers
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
}*/
|
}*/
|
||||||
syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode);
|
syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode, List<string> DefinesList = null);
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,13 +115,13 @@ namespace PascalABCCompiler.Parsers
|
||||||
// return p.Keywords;
|
// return p.Keywords;
|
||||||
// return null;
|
// return null;
|
||||||
//}
|
//}
|
||||||
public SyntaxTree.syntax_tree_node Compile(string FileName, string Text, List<Error> Errors, ParseMode ParseMode)
|
public SyntaxTree.syntax_tree_node Compile(string FileName, string Text, List<Error> Errors, ParseMode ParseMode, List<string> DefinesList = null)
|
||||||
{
|
{
|
||||||
LastParser = selectParser(Path.GetExtension(FileName).ToLower());
|
LastParser = selectParser(Path.GetExtension(FileName).ToLower());
|
||||||
if (LastParser == null)
|
if (LastParser == null)
|
||||||
throw new ParserBadFileExtension(FileName);
|
throw new ParserBadFileExtension(FileName);
|
||||||
LastParser.Errors = Errors;
|
LastParser.Errors = Errors;
|
||||||
return LastParser.BuildTree(FileName, Text, ParseMode);
|
return LastParser.BuildTree(FileName, Text, ParseMode, DefinesList);
|
||||||
}
|
}
|
||||||
public SyntaxTree.compilation_unit GetCompilationUnitSpecial(string FileName, string Text, List<Error> Errors)
|
public SyntaxTree.compilation_unit GetCompilationUnitSpecial(string FileName, string Text, List<Error> Errors)
|
||||||
{
|
{
|
||||||
|
|
@ -134,9 +134,9 @@ namespace PascalABCCompiler.Parsers
|
||||||
return null;
|
return null;
|
||||||
//throw new Errors.CompilerInternalError("Parsers.Controller.GetComilationUnit", new Exception("bad node type"));
|
//throw new Errors.CompilerInternalError("Parsers.Controller.GetComilationUnit", new Exception("bad node type"));
|
||||||
}
|
}
|
||||||
public SyntaxTree.compilation_unit GetCompilationUnit(string FileName, string Text, List<Error> Errors)
|
public SyntaxTree.compilation_unit GetCompilationUnit(string FileName, string Text, List<Error> Errors, List<string> DefinesList = null)
|
||||||
{
|
{
|
||||||
SyntaxTree.syntax_tree_node cu = Compile(FileName, Text, Errors, ParseMode.Normal);
|
SyntaxTree.syntax_tree_node cu = Compile(FileName, Text, Errors, ParseMode.Normal, DefinesList);
|
||||||
if (cu == null)
|
if (cu == null)
|
||||||
return null;
|
return null;
|
||||||
if (cu is SyntaxTree.compilation_unit)
|
if (cu is SyntaxTree.compilation_unit)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
//
|
//
|
||||||
// This CSharp output file generated by Gardens Point LEX
|
// This CSharp output file generated by Gardens Point LEX
|
||||||
// Version: 1.1.3.301
|
// Version: 1.1.3.301
|
||||||
// Machine: SSM
|
// Machine: IVAN-PC
|
||||||
// DateTime: 25.04.2016 9:01:24
|
// DateTime: 26.05.2016 12:11:54
|
||||||
// UserName: ?????????
|
// UserName: Ivan
|
||||||
// GPLEX input file <ABCPascal.lex>
|
// GPLEX input file <ABCPascal.lex>
|
||||||
// GPLEX frame file <embedded resource>
|
// GPLEX frame file <embedded resource>
|
||||||
//
|
//
|
||||||
|
|
@ -140,7 +140,7 @@ public PT parsertools;
|
||||||
Stack<BufferContext> buffStack = new Stack<BufferContext>();
|
Stack<BufferContext> buffStack = new Stack<BufferContext>();
|
||||||
Stack<string> fNameStack = new Stack<string>();
|
Stack<string> fNameStack = new Stack<string>();
|
||||||
Stack<int> IfStack = new Stack<int>(); // 0 - if, 1 - else
|
Stack<int> IfStack = new Stack<int>(); // 0 - if, 1 - else
|
||||||
List<string> Defines = new List<string>();
|
public List<string> Defines = new List<string>();
|
||||||
int IfExclude;
|
int IfExclude;
|
||||||
string Pars;
|
string Pars;
|
||||||
string directivename;
|
string directivename;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Stack<BufferContext> buffStack = new Stack<BufferContext>();
|
Stack<BufferContext> buffStack = new Stack<BufferContext>();
|
||||||
Stack<string> fNameStack = new Stack<string>();
|
Stack<string> fNameStack = new Stack<string>();
|
||||||
Stack<int> IfStack = new Stack<int>(); // 0 - if, 1 - else
|
Stack<int> IfStack = new Stack<int>(); // 0 - if, 1 - else
|
||||||
List<string> Defines = new List<string>();
|
public List<string> Defines = new List<string>();
|
||||||
int IfExclude;
|
int IfExclude;
|
||||||
string Pars;
|
string Pars;
|
||||||
string directivename;
|
string directivename;
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ namespace PascalABCCompiler.DocTagsParser
|
||||||
dcs.text = text;
|
dcs.text = text;
|
||||||
return dcs;
|
return dcs;
|
||||||
}
|
}
|
||||||
public syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode)
|
public syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode, List<string> DefinesList = null)
|
||||||
{
|
{
|
||||||
MatchCollection mc = Regex.Matches(Text, @"(([\f\t\v\x85\p{Z}])*///.*\r\n)*([\f\t\v\x85\p{Z}])*///.*", RegexOptions.Compiled);
|
MatchCollection mc = Regex.Matches(Text, @"(([\f\t\v\x85\p{Z}])*///.*\r\n)*([\f\t\v\x85\p{Z}])*///.*", RegexOptions.Compiled);
|
||||||
syntax_tree_node cu = null;
|
syntax_tree_node cu = null;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ namespace PascalABCCompiler.PascalABCNewParser
|
||||||
private List<Errors.Error> Errs;
|
private List<Errors.Error> Errs;
|
||||||
private string FileName;
|
private string FileName;
|
||||||
public bool build_tree_for_formatter = false;
|
public bool build_tree_for_formatter = false;
|
||||||
|
public List<string> DefinesList = null;
|
||||||
|
|
||||||
public GPPGParserHelper(List<Errors.Error> Errs, string FileName)
|
public GPPGParserHelper(List<Errors.Error> Errs, string FileName)
|
||||||
{
|
{
|
||||||
|
|
@ -45,7 +46,8 @@ namespace PascalABCCompiler.PascalABCNewParser
|
||||||
Scanner scanner = new Scanner();
|
Scanner scanner = new Scanner();
|
||||||
scanner.SetSource(Text, 0);
|
scanner.SetSource(Text, 0);
|
||||||
scanner.parsertools = parsertools;// передали parsertools в объект сканера
|
scanner.parsertools = parsertools;// передали parsertools в объект сканера
|
||||||
|
if (DefinesList != null)
|
||||||
|
scanner.Defines.AddRange(DefinesList);
|
||||||
GPPGParser parser = new GPPGParser(scanner);
|
GPPGParser parser = new GPPGParser(scanner);
|
||||||
parsertools.build_tree_for_formatter = build_tree_for_formatter;
|
parsertools.build_tree_for_formatter = build_tree_for_formatter;
|
||||||
parser.parsertools = parsertools; // передали parsertools в объект парсера
|
parser.parsertools = parsertools; // передали parsertools в объект парсера
|
||||||
|
|
@ -136,7 +138,7 @@ namespace PascalABCCompiler.PascalABCNewParser
|
||||||
//preprocessor2 = new Preprocessor2.Preprocessor2(SourceFilesProvider);
|
//preprocessor2 = new Preprocessor2.Preprocessor2(SourceFilesProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PascalABCCompiler.SyntaxTree.syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode)
|
public override PascalABCCompiler.SyntaxTree.syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode, List<string> DefinesList = null)
|
||||||
{
|
{
|
||||||
syntax_tree_node root = null;
|
syntax_tree_node root = null;
|
||||||
|
|
||||||
|
|
@ -144,7 +146,7 @@ namespace PascalABCCompiler.PascalABCNewParser
|
||||||
switch (ParseMode)
|
switch (ParseMode)
|
||||||
{
|
{
|
||||||
case ParseMode.Normal:
|
case ParseMode.Normal:
|
||||||
root = BuildTreeInNormalMode(FileName, Text);
|
root = BuildTreeInNormalMode(FileName, Text, DefinesList);
|
||||||
break;
|
break;
|
||||||
case ParseMode.Expression:
|
case ParseMode.Expression:
|
||||||
root = BuildTreeInExprMode(FileName, Text);
|
root = BuildTreeInExprMode(FileName, Text);
|
||||||
|
|
@ -178,7 +180,7 @@ namespace PascalABCCompiler.PascalABCNewParser
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override syntax_tree_node BuildTreeInNormalMode(string FileName, string Text)
|
public override syntax_tree_node BuildTreeInNormalMode(string FileName, string Text, List<string> DefinesList = null)
|
||||||
{
|
{
|
||||||
Errors.Clear();
|
Errors.Clear();
|
||||||
|
|
||||||
|
|
@ -194,7 +196,7 @@ namespace PascalABCCompiler.PascalABCNewParser
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
localparserhelper = new GPPGParserHelper(Errors, FileName);
|
localparserhelper = new GPPGParserHelper(Errors, FileName);
|
||||||
|
localparserhelper.DefinesList = DefinesList;
|
||||||
syntax_tree_node root = localparserhelper.Parse(Text);
|
syntax_tree_node root = localparserhelper.Parse(Text);
|
||||||
|
|
||||||
if (Errors.Count > 0)
|
if (Errors.Count > 0)
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ namespace PascalABCCompiler.VBNETParser
|
||||||
dcs.text = text;
|
dcs.text = text;
|
||||||
return dcs;
|
return dcs;
|
||||||
}
|
}
|
||||||
public syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode)
|
public syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode, List<string> DefinesList = null)
|
||||||
{
|
{
|
||||||
MatchCollection mc = Regex.Matches(Text, @"(([\f\t\v\x85\p{Z}])*///.*\r\n)*([\f\t\v\x85\p{Z}])*'''.*", RegexOptions.Compiled);
|
MatchCollection mc = Regex.Matches(Text, @"(([\f\t\v\x85\p{Z}])*///.*\r\n)*([\f\t\v\x85\p{Z}])*'''.*", RegexOptions.Compiled);
|
||||||
syntax_tree_node cu = null;
|
syntax_tree_node cu = null;
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ namespace PascalABCCompiler.VBNETParser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode)
|
public syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode, List<string> DefinesList = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Text))
|
if (string.IsNullOrEmpty(Text))
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
10
TestSuite/debug1.pas
Normal file
10
TestSuite/debug1.pas
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
begin
|
||||||
|
var i: integer;
|
||||||
|
{$IFDEF DEBUG}
|
||||||
|
i := 2;
|
||||||
|
{$ENDIF}
|
||||||
|
{$IFDEF RELEASE}
|
||||||
|
i := 3;
|
||||||
|
{$ENDIF}
|
||||||
|
assert(i = {$IFDEF DEBUG}2{$ELSE}3{$ENDIF});
|
||||||
|
end.
|
||||||
Loading…
Reference in a new issue