BadScript 2
Loading...
Searching...
No Matches
BadImportExpressionParser.cs
Go to the documentation of this file.
6
8
13{
15 public override bool IsValue(BadSourceParser parser)
16 {
17 return parser.Reader.IsKey(BadStaticKeys.IMPORT_KEY);
18 }
19
22 {
24 parser.Reader.SkipNonToken();
25 string name = parser.Reader.ParseWord().Text;
26 parser.Reader.SkipNonToken();
28 parser.Reader.SkipNonToken();
29 BadStringToken pathResult = parser.Reader.ParseString();
30 string path = pathResult.Value.Substring(1, pathResult.Value.Length - 2);
31
32 return new BadImportExpression(name, path, pos.Combine(pathResult.SourcePosition));
33 }
34}
Describes a specific position inside a source file.
BadSourcePosition Combine(BadSourcePosition other)
Combines two Source Positions.
Contains Static Data for the BadScript Language.
The Parser of the Language. It turns Source Code into an Expression Tree.
BadSourceReader Reader
The Source Reader.
Base Implementation for all Expressions used inside the Script.
A Import Expression that is used to import a module from a specified path.
Base class for all Value Parsers.
override BadExpression ParseValue(BadSourceParser parser)
BadSourcePosition Eat(char c)
Asserts that the current character matches the specified character.
BadSourcePosition SourcePosition
The Source Position of the Token.
Definition BadToken.cs:22
Implements a Token that represents a String.
Contains Shared Data Structures and Functionality.
Contains the Expressions for the BadScript2 Language.
Contains the Primitive Tokens for the BadScript2 Language.
Contains the Source Reader for the BadScript2 Language.