Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Remove "import" keyword #50

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Source/Core.Parsers/Parsers/Scanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public interface IScannerHandler

private Encoding Encoding { get { return sourceUnit.Encoding; } }
private bool IsPure { get { return sourceUnit.IsPure; } }
public static bool IsLegacy;

public Scanner(TextReader/*!*/ reader, SourceUnit/*!*/ sourceUnit, ErrorSink/*!*/ errors,
ICommentsSink commentsSink, LanguageFeatures features, int positionShift)
Expand Down Expand Up @@ -492,13 +493,13 @@ private void UpdateTokenPosition()

case Tokens.T_IMPORT:
{
if (!sourceUnit.IsPure)
if (sourceUnit.IsPure && Scanner.IsLegacy)
{
token = Tokens.T_STRING;
goto case Tokens.T_STRING;
goto default;
}

goto default;
token = Tokens.T_STRING;
goto case Tokens.T_STRING;
}

case Tokens.T_BOOL_TYPE:
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/Compiler/AppCompiler.CLR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ public CommandLineParser()
"/ew:<warning>", "ew",
"/verbose[+|-]", "verbose",
"/quiet", "quiet",
"/legacy", "legacy",
"@<path>", "at_path",
};

Expand Down Expand Up @@ -847,6 +848,8 @@ public bool Parse(List<string>/*!*/ args)
case "ig": drawInclusionGraph = true; break;
case "errors-to-stdout": redirectErrors = true; break;

case "legacy": Parsers.Scanner.IsLegacy = true; break;

case "?":
case "help":
showHelp = true;
Expand Down