// Object names can be: // name // prefix.name // Property names can be: // name // attachedPropertyObject.name // prefix.attachedPropertyObject.name public static bool LooksLikeCompoundName(this TokenBuffer <LexerTokenType> tokenBuffer, out int length) { length = 0; var tokenType0 = tokenBuffer.LookAhead(0, LexerTokenType.Unknown); var tokenType1 = tokenBuffer.LookAhead(1, LexerTokenType.Unknown); var tokenType2 = tokenBuffer.LookAhead(2, LexerTokenType.Unknown); var tokenType3 = tokenBuffer.LookAhead(3, LexerTokenType.Unknown); var tokenType4 = tokenBuffer.LookAhead(4, LexerTokenType.Unknown); if (tokenType0 == LexerTokenType.Identifier) { length = 1; if (tokenType1 == LexerTokenType.Period && tokenType2 == LexerTokenType.Identifier) { length = 3; if (tokenType3 == LexerTokenType.Period && tokenType4 == LexerTokenType.Identifier) { length = 5; } } return(true); } return(false); }
public static bool LooksLikeQualifiedName( this TokenBuffer <LexerTokenType> tokenBuffer, LexerTokenType qualifierDelimeter) { var tokenType0 = tokenBuffer.LookAhead(0, LexerTokenType.Unknown); var tokenType1 = tokenBuffer.LookAhead(1, LexerTokenType.Unknown); return(tokenType0 == LexerTokenType.Identifier && tokenType1 == qualifierDelimeter); }
// See if the name is followed by an equals.... public static bool LooksLikePropertyAssignment(this TokenBuffer <LexerTokenType> tokenBuffer) { int nameLength; if (tokenBuffer.LooksLikeCompoundName(out nameLength)) { var tokenTypeFollowing = tokenBuffer.LookAhead(nameLength, LexerTokenType.Unknown); if (tokenTypeFollowing == LexerTokenType.Equals) { return(true); } } return(false); }