Converted parser into a class so that individual parsing methods can be overridden
This commit is contained in:
parent
7f9c0a4fb6
commit
77684566ec
|
@ -90,7 +90,7 @@ Module parseModule(const(Token)[] tokens, string fileName,
|
||||||
/**
|
/**
|
||||||
* Parser structure
|
* Parser structure
|
||||||
*/
|
*/
|
||||||
struct Parser
|
class Parser
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Parses an AddExpression.
|
* Parses an AddExpression.
|
||||||
|
@ -2309,7 +2309,12 @@ class ClassFour(A, B) if (someTest()) : Super {}}c;
|
||||||
FunctionBody parseFunctionBody()
|
FunctionBody parseFunctionBody()
|
||||||
{
|
{
|
||||||
auto node = new FunctionBody;
|
auto node = new FunctionBody;
|
||||||
if (currentIs(TokenType.lBrace))
|
if (currentIs(TokenType.semicolon))
|
||||||
|
{
|
||||||
|
advance();
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
else if (currentIs(TokenType.lBrace))
|
||||||
node.blockStatement = parseBlockStatement();
|
node.blockStatement = parseBlockStatement();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5973,7 +5978,7 @@ q{doStuff(5)}c;
|
||||||
this.tokens = tokens;
|
this.tokens = tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
|
||||||
bool isCastQualifier() const
|
bool isCastQualifier() const
|
||||||
{
|
{
|
||||||
|
@ -6278,7 +6283,7 @@ private:
|
||||||
|
|
||||||
void skip(alias O, alias C)()
|
void skip(alias O, alias C)()
|
||||||
{
|
{
|
||||||
assert(currentIs(O));
|
assert(currentIs(O), current().value);
|
||||||
advance();
|
advance();
|
||||||
int depth = 1;
|
int depth = 1;
|
||||||
while (moreTokens())
|
while (moreTokens())
|
||||||
|
|
Loading…
Reference in New Issue