Директива HiddenParams для скрытых модулей

This commit is contained in:
Mikhalkovich Stanislav 2024-04-04 14:00:54 +03:00
parent 2192e7a5bc
commit 6d96161be1
6 changed files with 809 additions and 780 deletions

View file

@ -1187,7 +1187,9 @@ namespace PascalABCCompiler
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_endregion, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_ifdef,
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_endif, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_ifndef,
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_define, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_else,
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_undef, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_include});
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_undef, PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_include,
PascalABCCompiler.TreeConverter.compiler_string_consts.compiler_directive_hidden_idents,
});
private Dictionary<string, List<compiler_directive>> GetCompilerDirectives(List<CompilationUnit> Units)
{

File diff suppressed because it is too large Load diff

View file

@ -9,6 +9,7 @@
string directivename;
string directiveparam;
LexLocation currentLexLocation;
bool HiddenIdents = false;
%}
%namespace GPPGParserScanner
@ -22,7 +23,7 @@ Letter [[:IsLetter:]_]
Digit [0-9]
Digit_ [0-9_]
LetterDigit {Letter}|{Digit}
ID {Letter}{LetterDigit}*
ID `?{Letter}{LetterDigit}*
HexDigit {Digit}|[abcdefABCDEF]
HexDigit_ {Digit}|[abcdefABCDEF_]
DotChr [^\r\n]
@ -71,7 +72,11 @@ UNICODEARROW \x890
parsertools.DivideDirectiveOn(yytext,out directivename,out directiveparam);
parsertools.CheckDirectiveParams(directivename,directiveparam); // directivename in UPPERCASE!
if (directivename == "INCLUDE")
if (directivename == "HIDDENIDENTS")
{
HiddenIdents = true;
}
else if (directivename == "INCLUDE")
{
TryInclude(directiveparam);
}
@ -255,6 +260,8 @@ UNICODEARROW \x890
currentLexLocation = CurrentLexLocation;
if (res == (int)Tokens.tkIdentifier)
{
if (cur_yytext[0] == '`' && !HiddenIdents)
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}",CurrentLexLocation, "`");
yylval = new Union();
yylval.id = parsertools.create_ident(cur_yytext,currentLexLocation);
}

View file

@ -2,9 +2,9 @@
// GPPG version 1.3.6
// Machine: DESKTOP-G8V08V4
// DateTime: 21.03.2024 20:00:52
// DateTime: 04.04.2024 10:35:09
// UserName: ?????????
// Input file <ABCPascal.y>
// Input file <D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y>
// options: no-lines gplex
@ -60,7 +60,7 @@ public abstract class ScanBase : AbstractScanner<PascalABCSavParser.Union,LexLoc
public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, LexLocation>
{
// Verbatim content from ABCPascal.y
// Verbatim content from D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y
// Э<>об<D0BE>?явления добавля<D0BB>?<3F>?ся в класс GPPGParser, п<>?едс<D0B4>?авля<D0BB>?<3F>?ий собой па<D0BF>?се<D181>?, гене<D0BD><>?<3F>?ем<D0B5>сис<D0B8>?емой gppg
public syntax_tree_node root; // <20>?о<>?невой <20>?зел син<D0B8>?акси<D181>?еского де<D0B4>?ева
@ -72,7 +72,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
public ParserLambdaHelper lambdaHelper = new ParserLambdaHelper();
public GPPGParser(AbstractScanner<PascalABCSavParser.Union, LexLocation> scanner) : base(scanner) { }
// End verbatim content from ABCPascal.y
// End verbatim content from D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y
#pragma warning disable 649
private static Dictionary<int, string> aliasses;

View file

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

View file

@ -346,6 +346,7 @@ namespace PascalABCCompiler.TreeConverter
public static string compiler_directive_define = "define";
public static string compiler_directive_include = "include";
public static string compiler_directive_targetframework = "targetframework";
public static string compiler_directive_hidden_idents = "hiddenidents";
public const string version_string = "version";
public const string product_string = "product";
public const string company_string = "company";