mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 18:02:31 +08:00
Merge pull request #6243 from sfc-gh-anoyes/anoyes/disallow-preprocessor-in-actors
Reject preprocessor directives in ACTORs
This commit is contained in:
commit
95d1a847d6
@ -929,6 +929,8 @@ namespace actorcompiler
|
|||||||
Add(ParseStateDeclaration(toks));
|
Add(ParseStateDeclaration(toks));
|
||||||
else if (toks.First().Value == "switch" && toks.Any(t => t.Value == "return"))
|
else if (toks.First().Value == "switch" && toks.Any(t => t.Value == "return"))
|
||||||
throw new Error(toks.First().SourceLine, "Unsupported compound statement containing return.");
|
throw new Error(toks.First().SourceLine, "Unsupported compound statement containing return.");
|
||||||
|
else if (toks.First().Value.StartsWith("#"))
|
||||||
|
throw new Error(toks.First().SourceLine, "Found \"{0}\". Preprocessor directives are not supported within ACTORs", toks.First().Value);
|
||||||
else if (toks.RevSkipWhile(t => t.Value == ";").Any(NonWhitespace))
|
else if (toks.RevSkipWhile(t => t.Value == ";").Any(NonWhitespace))
|
||||||
Add(new PlainOldCodeStatement
|
Add(new PlainOldCodeStatement
|
||||||
{
|
{
|
||||||
@ -1131,7 +1133,8 @@ namespace actorcompiler
|
|||||||
@"\n",
|
@"\n",
|
||||||
@"::",
|
@"::",
|
||||||
@":",
|
@":",
|
||||||
@"."
|
@"#[a-z]*", // Recognize preprocessor directives so that we can reject them
|
||||||
|
@".",
|
||||||
}).Select( x=>new Regex(@"\G"+x, RegexOptions.Singleline) ).ToArray();
|
}).Select( x=>new Regex(@"\G"+x, RegexOptions.Singleline) ).ToArray();
|
||||||
|
|
||||||
IEnumerable<string> Tokenize(string text)
|
IEnumerable<string> Tokenize(string text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user