More work on the parser

This commit is contained in:
Hackerpilot 2013-06-22 17:23:30 -07:00
parent 3a66f01405
commit 2802eb20a9
3 changed files with 691 additions and 356 deletions

View File

@ -251,9 +251,9 @@ class AddExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */TokenType operator; /** */ TokenType operator;
/** */AddExpression left; /** */ AddExpression left;
/** */MulExpression right; /** */ MulExpression right;
} }
/// ///
@ -261,9 +261,9 @@ class AliasDeclaration : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */Type type; /** */ Type type;
/** */Declarator declarator; /** */ Declarator declarator;
/** */AliasInitializer[] initializations; /** */ AliasInitializer[] initializations;
} }
/// ///
@ -271,8 +271,8 @@ class AliasInitializer : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */Token identifier; /** */ Token identifier;
/** */Type type; /** */ Type type;
} }
/// ///
@ -280,7 +280,7 @@ class AliasThisDeclaration : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */Token identifier; /** */ Token identifier;
} }
/// ///
@ -288,7 +288,7 @@ class AlignAttribute : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */Token intLiteral; /** */ Token intLiteral;
} }
/// ///
@ -296,8 +296,8 @@ class AndAndExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AndAndExpression left; /** */ AndAndExpression left;
/** */OrExpression right; /** */ OrExpression right;
} }
/// ///
@ -305,8 +305,8 @@ class AndExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AndExpression andExpression; /** */ AndExpression left;
/** */ShiftExpression shiftExpression; /** */ CmpExpression right;
} }
/// ///
@ -314,7 +314,7 @@ class ArgumentList : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AssignExpression[] arguments; /** */ AssignExpression[] arguments;
} }
/// ///
@ -322,7 +322,7 @@ class Arguments : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ArgumentList argumentList; /** */ ArgumentList argumentList;
} }
/// ///
@ -330,7 +330,7 @@ class ArrayInitializer : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ArrayMemberInitialization[] arrayMemberInitializations; /** */ ArrayMemberInitialization[] arrayMemberInitializations;
} }
/// ///
@ -338,7 +338,7 @@ class ArrayLiteral : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ArgumentList argumentList; /** */ ArgumentList argumentList;
} }
/// ///
@ -346,8 +346,8 @@ class ArrayMemberInitialization : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AssignExpression assignExpression; /** */ AssignExpression assignExpression;
/** */NonVoidInitializer nonVoidInitializer; /** */ NonVoidInitializer nonVoidInitializer;
} }
/// ///
@ -355,9 +355,9 @@ class AsmAddExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */Token operator; /** */ TokenType operator;
/** */AsmMulExp left; /** */ AsmAddExp left;
/** */AsmMulExp right; /** */ AsmMulExp right;
} }
/// ///
@ -365,8 +365,8 @@ class AsmAndExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmEqualExp left; /** */ AsmEqualExp left;
/** */AsmEqualExp right; /** */ AsmEqualExp right;
} }
/// ///
@ -374,9 +374,9 @@ class AsmBrExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmBrExp asmBrExp; /** */ AsmBrExp asmBrExp;
/** */AsmEqualExp asmEqualExp; /** */ AsmEqualExp asmEqualExp;
/** */AsmUnaExp asmUnaExp; /** */ AsmUnaExp asmUnaExp;
} }
/// ///
@ -384,9 +384,9 @@ class AsmEqualExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmRelExp left; /** */ AsmRelExp left;
/** */AsmRelExp right; /** */ AsmRelExp right;
/** */Token operator; /** */ Token operator;
} }
/// ///
@ -394,9 +394,9 @@ class AsmExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmLogOrExp left; /** */ AsmLogOrExp left;
/** */AsmExp middle; /** */ AsmExp middle;
/** */AsmExp right; /** */ AsmExp right;
} }
/// ///
@ -404,10 +404,10 @@ class AsmInstruction : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */Token identifierOrIntegerOrOpcode; /** */ Token identifierOrIntegerOrOpcode;
/** */bool hasAlign; /** */ bool hasAlign;
/** */AsmExp asmExp; /** */ AsmExp asmExp;
/** */Operands operands; /** */ Operands operands;
} }
/// ///
@ -415,8 +415,8 @@ class AsmLogAndExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmOrExp left; /** */ AsmOrExp left;
/** */AsmOrExp right; /** */ AsmOrExp right;
} }
/// ///
@ -424,8 +424,8 @@ class AsmLogOrExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmLogAndExp left; /** */ AsmLogAndExp left;
/** */AsmLogAndExp right; /** */ AsmLogAndExp right;
} }
/// ///
@ -433,9 +433,10 @@ class AsmMulExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmBrExp left; /** */ TokenType operator;
/** */AsmBrExp right; /** */ AsmMulExp left;
/** */Token operator; /** */ AsmBrExp right;
} }
/// ///
@ -443,8 +444,8 @@ class AsmOrExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmXorExp left; /** */ AsmXorExp left;
/** */AsmXorExp right; /** */ AsmXorExp right;
} }
/// ///
@ -452,9 +453,9 @@ class AsmPrimaryExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */IdentifierChain identifierChain; /** */ IdentifierChain identifierChain;
/** */Register register; /** */ Register register;
/** */Token token; /** */ Token token;
} }
/// ///
@ -462,9 +463,9 @@ class AsmRelExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmShiftExp left; /** */ AsmShiftExp left;
/** */AsmShiftExp right; /** */ AsmShiftExp right;
/** */Token operator; /** */ Token operator;
} }
/// ///
@ -472,9 +473,9 @@ class AsmShiftExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmAddExp left; /** */ AsmAddExp left;
/** */AsmAddExp right; /** */ AsmAddExp right;
/** */Token operator; /** */ Token operator;
} }
/// ///
@ -482,7 +483,7 @@ class AsmStatement : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmInstruction[] asmInstructions; /** */ AsmInstruction[] asmInstructions;
} }
/// ///
@ -490,8 +491,8 @@ class AsmTypePrefix : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */Token left; /** */ Token left;
/** */Token right; /** */ Token right;
} }
/// ///
@ -499,11 +500,11 @@ class AsmUnaExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmTypePrefix asmTypePrefix; /** */ AsmTypePrefix asmTypePrefix;
/** */AsmExp asmExp; /** */ AsmExp asmExp;
/** */Token prefix; /** */ Token prefix;
/** */AsmPrimaryExp asmPrimaryExp; /** */ AsmPrimaryExp asmPrimaryExp;
/** */AsmUnaExp asmUnaExp; /** */ AsmUnaExp asmUnaExp;
} }
/// ///
@ -511,8 +512,8 @@ class AsmXorExp : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AsmAndExp left; /** */ AsmAndExp left;
/** */AsmAndExp right; /** */ AsmAndExp right;
} }
/// ///
@ -520,8 +521,8 @@ class AssertExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AssignExpression assertion; /** */ AssignExpression assertion;
/** */AssignExpression message; /** */ AssignExpression message;
} }
/// ///
@ -529,7 +530,7 @@ class AssertStatement : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AssertExpression assertExpression; /** */ AssertExpression assertExpression;
} }
/// ///
@ -537,9 +538,9 @@ class AssignExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */TernaryExpression ternaryExpression; /** */ TernaryExpression ternaryExpression;
/** */AssignExpression assignExpression; /** */ AssignExpression assignExpression;
/** */TokenType operator; /** */ TokenType operator;
} }
/// ///
@ -547,11 +548,11 @@ class AssignStatement : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */PreIncDecExpression preIncDecExpression; /** */ PreIncDecExpression preIncDecExpression;
/** */PostIncDecExpression postIncDecExpression; /** */ PostIncDecExpression postIncDecExpression;
/** */UnaryExpression[] unaryExpressions; /** */ UnaryExpression[] unaryExpressions;
/** */AssignExpression[] assignExpressions; /** */ AssignExpression[] assignExpressions;
/** */TokenType[] assignOperators; /** */ TokenType[] assignOperators;
} }
/// ///
@ -559,7 +560,7 @@ class AssocArrayLiteral : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */KeyValuePairs keyValuePairs; /** */ KeyValuePairs keyValuePairs;
} }
/// ///
@ -567,9 +568,9 @@ class AtAttribute : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */FunctionCallExpression functionCallExpression; /** */ FunctionCallExpression functionCallExpression;
/** */ArgumentList argumentList; /** */ ArgumentList argumentList;
/** */Token identifier; /** */ Token identifier;
} }
/// ///
@ -586,8 +587,8 @@ public:
visitor.visit(dec); visitor.visit(dec);
} }
} }
/** */Attribute attribute; /** */ Attribute attribute;
/** */Declaration[] declarations; /** */ Declaration[] declarations;
} }
/// ///
@ -595,12 +596,12 @@ class Attribute : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */LinkageAttribute linkageAttribute; /** */ LinkageAttribute linkageAttribute;
/** */AlignAttribute alignAttribute; /** */ AlignAttribute alignAttribute;
/** */PragmaExpression pragmaExpression; /** */ PragmaExpression pragmaExpression;
/** */Deprecated deprecated_; /** */ Deprecated deprecated_;
/** */AtAttribute atAttribute; /** */ AtAttribute atAttribute;
/** */TokenType attribute; /** */ TokenType attribute;
} }
/// ///
@ -608,9 +609,9 @@ class AutoDeclaration : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */StorageClass storageClass; /** */ StorageClass storageClass;
/** */Token[] identifiers; /** */ Token[] identifiers;
/** */Initializer[] initializers; /** */ Initializer[] initializers;
} }
/// ///
@ -618,7 +619,7 @@ class BlockStatement : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */DeclarationsAndStatements declarationsAndStatements; /** */ DeclarationsAndStatements declarationsAndStatements;
} }
/// ///
@ -626,7 +627,7 @@ class BodyStatement : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */BlockStatement blockStatement; /** */ BlockStatement blockStatement;
} }
/// ///
@ -660,7 +661,7 @@ class BasicType : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */TokenType type; /** */ TokenType type;
} }
/// ///
@ -668,9 +669,9 @@ class CaseRangeStatement : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */AssignExpression low; /** */ AssignExpression low;
/** */AssignExpression high; /** */ AssignExpression high;
/** */DeclarationsAndStatements declarationsAndStatements; /** */ DeclarationsAndStatements declarationsAndStatements;
} }
/// ///
@ -678,8 +679,8 @@ class CaseStatement: ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ArgumentList argumentList; /** */ ArgumentList argumentList;
/** */DeclarationsAndStatements declarationsAndStatements; /** */ DeclarationsAndStatements declarationsAndStatements;
} }
/// ///
@ -687,9 +688,9 @@ class CastExpression: ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */Type type; /** */ Type type;
/** */CastQualifier castQualifier; /** */ CastQualifier castQualifier;
/** */UnaryExpression unaryExpression; /** */ UnaryExpression unaryExpression;
} }
/// ///
@ -697,9 +698,9 @@ class CastQualifier: ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */TokenType first; /** */ TokenType first;
/** */TokenType second; /** */ TokenType second;
/** */bool hasSecond; /** */ bool hasSecond;
} }
/// ///
@ -758,9 +759,9 @@ class CompileCondition : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */VersionCondition versionCondition; /** */ VersionCondition versionCondition;
/** */DebugCondition debugCondition; /** */ DebugCondition debugCondition;
/** */StaticIfCondition staticIfCondition; /** */ StaticIfCondition staticIfCondition;
} }
/// ///
@ -768,9 +769,9 @@ class ConditionalDeclaration : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */CompileCondition compileCondition; /** */ CompileCondition compileCondition;
/** */Declaration[] trueDeclarations; /** */ Declaration[] trueDeclarations;
/** */Declaration[] falseDeclarations; /** */ Declaration[] falseDeclarations;
} }
/// ///
@ -778,9 +779,9 @@ class ConditionalStatement : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */CompileCondition compileCondition; /** */ CompileCondition compileCondition;
/** */StatementNoCaseNoDefault trueStatement; /** */ StatementNoCaseNoDefault trueStatement;
/** */StatementNoCaseNoDefault falseStatement; /** */ StatementNoCaseNoDefault falseStatement;
} }
/// ///
@ -788,7 +789,7 @@ class Constraint : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */Expression expression; /** */ Expression expression;
} }
/// ///
@ -796,8 +797,8 @@ class Constructor : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */Parameters parameters; /** */ Parameters parameters;
/** */FunctionBody functionBody; /** */ FunctionBody functionBody;
} }
/// ///
@ -991,7 +992,9 @@ class EqualExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
mixin(SHIFT_SHIFT_BODY); /** */ TokenType operator;
/** */ ShiftExpression left;
/** */ ShiftExpression right;
} }
/// ///
@ -999,7 +1002,7 @@ class Expression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ AssignExpression[] assignExpressions; /** */ AssignExpression[] items;
} }
/// ///
@ -1140,8 +1143,7 @@ class GotoStatement : ASTNode
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ Expression expression; /** */ Expression expression;
/** */ Token identifier; /** */ Token token;
/** */ bool isDefault;
} }
/// ///
@ -1182,7 +1184,9 @@ class IdentityExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
mixin(SHIFT_SHIFT_BODY); /** */ bool negated;
/** */ ShiftExpression left;
/** */ ShiftExpression right;
} }
/// ///
@ -1320,7 +1324,8 @@ class KeyValuePair : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ KeyValuePair[] keyValuePairs; /** */ AssignExpression key;
/** */ AssignExpression value;
} }
/// ///
@ -1328,8 +1333,7 @@ class KeyValuePairs : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ AssignExpression key; /** */ KeyValuePair[] keyValuePairs;
/** */ AssignExpression value;
} }
/// ///
@ -1433,8 +1437,8 @@ class MulExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ Token operator; /** */ TokenType operator;
/** */ UnaryExpression left; /** */ MulExpression left;
/** */ UnaryExpression right; /** */ UnaryExpression right;
} }
@ -1445,10 +1449,8 @@ public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ Arguments allocatorArguments; /** */ Arguments allocatorArguments;
/** */ Arguments constructorArguments; /** */ Arguments constructorArguments;
/** */ IdentifierList identifierList; /** */ BaseClassList baseClassList;
/** */ ClassBody /// /** */ ClassBody classBody;
classBody;
} }
/// ///
@ -1541,8 +1543,8 @@ class OrExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ XorExpression xorExpression; /** */ OrExpression left;
/** */ OrExpression orExpression; /** */ XorExpression right;
} }
/// ///
@ -1550,8 +1552,8 @@ class OrOrExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ OrOrExpression orOrExpression; /** */ OrOrExpression left;
/** */ AndAndExpression andAndExpression; /** */ AndAndExpression right;
} }
/// ///
@ -1614,8 +1616,8 @@ class PowExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ UnaryExpression unaryExpression; /** */ PowExpression left;
/** */ PowExpression powExpression; /** */ UnaryExpression right;
} }
/// ///
@ -1650,20 +1652,19 @@ class PrimaryExpression : ASTNode
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ Token primary; /** */ Token primary;
/** */ bool hasDot; /** */ IdentifierOrTemplateInstance identifierOrTemplateInstance;
IdentifierOrTemplateInstance identifierOrTemplateInstance; /** */ Type type;
Type type; /** */ TypeofExpression typeofExpression;
TypeofExpression typeofExpression; /** */ TypeidExpression typeidExpression;
TypeidExpression typeidExpression; /** */ ArrayLiteral arrayLiteral;
ArrayLiteral arrayLiteral; /** */ AssocArrayLiteral assocArrayLiteral;
AssocArrayLiteral assocArrayLiteral; /** */ Expression expression;
Expression expression; /** */ IsExpression isExpression;
IsExpression isExpression; /** */ LambdaExpression lambdaExpression;
LambdaExpression lambdaExpression; /** */ FunctionLiteralExpression functionLiteralExpression;
FunctionLiteralExpression functionLiteralExpression; /** */ TraitsExpression traitsExpression;
TraitsExpression traitsExpression; /** */ MixinExpression mixinExpression;
MixinExpression mixinExpression; /** */ ImportExpression importExpression;
ImportExpression importExpression;
} }
/// ///
@ -1681,7 +1682,9 @@ class RelExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
mixin(SHIFT_SHIFT_BODY); /** */ TokenType operator;
/** */ RelExpression left;
/** */ ShiftExpression right;
} }
/// ///
@ -1722,9 +1725,9 @@ class ShiftExpression : ASTNode
{ {
public: public:
mixin(DEFAULT_ACCEPT); mixin(DEFAULT_ACCEPT);
/** */ AddExpression addExpression; /** */ TokenType operator;
/** */ ShiftExpression shiftExpression; /** */ ShiftExpression left;
/** */ Token operator; /** */ AddExpression right;
} }
/// ///

View File

@ -2220,7 +2220,7 @@ private:
// For now a private helper that is tailored to the way lexer works // For now a private helper that is tailored to the way lexer works
// hides away forwardness of range by buffering // hides away forwardness of range by buffering
// RA-version is strightforward thin wrapping // random-access version is a strightforward thin wrapping
// ATM it is byte-oriented // ATM it is byte-oriented
private struct LexSource(R) private struct LexSource(R)
if(isForwardRange!R && !isRandomAccessRange!R) if(isForwardRange!R && !isRandomAccessRange!R)
@ -3038,21 +3038,20 @@ struct StringCache
index = new Slot*[startSize]; index = new Slot*[startSize];
} }
string get(R)(R range) string get(R)(R range) if (isRandomAccessRange!R
if(isRandomAccessRange!R && is(Unqual!(ElementType!R) : const(ubyte)))
&& is(Unqual!(ElementType!R) : const(ubyte)))
{ {
uint h = hash(range); uint h = hash(range);
uint bucket = h & (index.length-1); uint bucket = h & (index.length-1);
Slot *s = index[bucket]; Slot *s = index[bucket];
if(s == null) if (s == null)
{ {
string str = putIntoCache(range); string str = putIntoCache(range);
index[bucket] = allocateSlot(str, h); index[bucket] = allocateSlot(str, h);
uniqueSlots++; uniqueSlots++;
return str; return str;
} }
for(;;) while (true)
{ {
if(s.hash == h && s.value.equal(range)) if(s.hash == h && s.value.equal(range))
return s.value; return s.value;
@ -3064,7 +3063,7 @@ struct StringCache
uniqueSlots++; uniqueSlots++;
// had at least 1 item in this bucket // had at least 1 item in this bucket
// and inserted another one - check load factor // and inserted another one - check load factor
if(uniqueSlots*loadDenom > index.length*loadQuot) if (uniqueSlots * loadDenom > index.length * loadQuot)
rehash(); rehash();
return str; return str;
} }

File diff suppressed because it is too large Load Diff