public CompressedState(Lexer lexer) { this._hereDocLabel = lexer._hereDocLabel; this._currentState = lexer.CurrentLexicalState; this._stateStack = lexer.stateStack.ToArray(); this._phpDoc = lexer.DocBlock; }
/// <summary> /// Initializes a new instance of the <c>LuatSyntaxLanguage</c> class. /// </summary> public LuatSyntaxLanguage(LuaIntellisenseBroker plugin) : base("Luat") { m_plugin = plugin; ExampleText = @"/* function HelloWorld() local a = 1 local b : FwVector4; end"; // Initialize highlighting styles (same as the LuaDefinition.xml values); helps SkinService HighlightingStyles.Add(new HighlightingStyle(ReservedWordStyleString, null, Color.Blue, Color.Empty)); HighlightingStyles.Add(new HighlightingStyle(FunctionStyleString, null, Color.Magenta, Color.Empty)); HighlightingStyles.Add(new HighlightingStyle(GlobalVariableStyleString, null, Color.Teal, Color.Empty)); HighlightingStyles.Add(new HighlightingStyle(OperatorStyleString, null, Color.Black, Color.Empty)); HighlightingStyles.Add(new HighlightingStyle(NumberStyleString, null, Color.Purple, Color.Empty)); HighlightingStyles.Add(new HighlightingStyle(StringDelimiterStyleString, null, Color.Maroon, Color.Empty)); HighlightingStyles.Add(new HighlightingStyle(StringDefaultStyleString, null, Color.Maroon, Color.Empty)); HighlightingStyles.Add(new HighlightingStyle(CommentDelimiterStyleString, null, Color.Green, Color.Empty)); HighlightingStyles.Add(new HighlightingStyle(CommentUrlStyleString, null, Color.Green, Color.Empty)); HighlightingStyles.Add(new HighlightingStyle(CommentTagStyleString, null, Color.Gray, Color.Empty)); HighlightingStyles.Add(new HighlightingStyle(CommentDefaultStyleString, null, Color.Green, Color.Empty)); // Initialize custom highlighting styles HighlightingStyles.Add(new HighlightingStyle(WarningStyleString, null, Color.Green, Color.Empty)); HighlightingStyles.Add(new HighlightingStyle(ReferenceStyleString, null, Color.Empty, Color.LightCyan)); HighlightingStyles.Add(new HighlightingStyle(AssignmentStyleString, null, Color.Empty, Color.MistyRose)); // Initialize lexical states LexicalStates.Add(new DefaultLexicalState(LuatLexicalStateId.Default, "DefaultState")); DefaultLexicalState = LexicalStates["DefaultState"]; LexicalStates["DefaultState"].DefaultHighlightingStyle = HighlightingStyles["DefaultStyle"]; }
private bool yy_pop_state() { if (stateStack.Count == 0) { return(false); } current_lexical_state = stateStack.Pop(); return(true); }
public void Initialize(System.IO.TextReader reader, LexicalStates lexicalState, bool atBol) { this.expanding_token = false; this.token_start = 0; this.chars_read = 0; this.lookahead_index = 0; this.token_chunk_start = 0; this.token_end = 0; this.reader = reader; this.yy_at_bol = atBol; this.current_lexical_state = lexicalState; }
/// <summary> /// Lexer constructor that initializes all the necessary members /// </summary> /// <param name="reader">Text reader containing the source code.</param> /// <param name="encoding">Source file encoding to convert UTF characters.</param> /// <param name="errors">Error sink used to report lexical error.</param> /// <param name="features">Allow or disable short oppening tags for PHP.</param> /// <param name="positionShift">Starting position of the first token, used during custom restart.</param> /// <param name="initialState">Initial state of the lexer, used during custom restart.</param> public Lexer( System.IO.TextReader reader, Encoding encoding, IErrorSink <Span> errors = null, LanguageFeatures features = LanguageFeatures.Basic, int positionShift = 0, LexicalStates initialState = LexicalStates.INITIAL) { _encoding = encoding ?? Encoding.UTF8; _errors = errors ?? new EmptyErrorSink <Span>(); _charOffset = positionShift; _allowShortTags = (features & LanguageFeatures.ShortOpenTags) != 0; Initialize(reader, initialState); }
bool ProcessText(int count, LexicalStates newState, char ending, out Tokens token) { _yyless(count); token = Tokens.T_ENCAPSED_AND_WHITESPACE; yy_push_state(newState); if (TokenLength > 0) { this._tokenSemantics.Object = ProcessEscapedStringWithEnding(GetTokenString(), _encoding, false, ending); return(true); } else { yymore(); return(false); } }
bool ProcessText(int count, LexicalStates newState, char ending, out Tokens token) { _yyless(count); token = Tokens.T_ENCAPSED_AND_WHITESPACE; yy_push_state(newState); if (TokenLength > 0) { _tokenSemantics.Object = new KeyValuePair <string, string>((string)ProcessEscapedStringWithEnding(buffer, BufferTokenStart, TokenLength, ending), GetTokenString()); return(true); } else { yymore(); return(false); } }
/// <summary> /// Lexer constructor that initializes all the necessary members /// </summary> /// <param name="reader">Text reader containing the source code.</param> /// <param name="encoding">Source file encoding to convert UTF characters.</param> /// <param name="errors">Error sink used to report lexical error.</param> /// <param name="features">Allow or disable short oppening tags for PHP.</param> /// <param name="positionShift">Starting position of the first token, used during custom restart.</param> /// <param name="initialState">Initial state of the lexer, used during custom restart.</param> public Lexer( System.IO.TextReader reader, Encoding encoding, IErrorSink <Span> errors = null, LanguageFeatures features = LanguageFeatures.Basic, int positionShift = 0, LexicalStates initialState = LexicalStates.INITIAL) { _encoding = encoding ?? Encoding.UTF8; _errors = errors ?? new EmptyErrorSink <Span>(); _charOffset = positionShift; _features = features; _strings = StringTable.GetInstance(); Initialize(reader, initialState); }
/// <summary> /// Lexer constructor that initializes all the necessary members /// </summary> /// <param name="reader">Text reader containing the source code.</param> /// <param name="encoding">Source file encoding to convert UTF characters.</param> /// <param name="errors">Error sink used to report lexical error.</param> /// <param name="features">Allow or disable short oppening tags for PHP.</param> /// <param name="docBlockFactory">Factory for documentary comment semantic elements.</param> /// <param name="positionShift">Starting position of the first token, used during custom restart.</param> /// <param name="initialState">Initial state of the lexer, used during custom restart.</param> public Lexer( System.IO.TextReader reader, Encoding encoding, IErrorSink <Span> errors = null, LanguageFeatures features = LanguageFeatures.Basic, IDocBlockFactory docBlockFactory = null, int positionShift = 0, LexicalStates initialState = LexicalStates.INITIAL) { _encoding = encoding ?? Encoding.UTF8; _errors = errors ?? new EmptyErrorSink <Span>(); _docblockFactory = docBlockFactory ?? DefaultDocBlockFactory.Instance; _charOffset = positionShift; _features = features; _strings = StringTable.GetInstance(); _processDoubleQuotedString = ProcessDoubleQuotedString; Initialize(reader, initialState); }
public CompressedState(Tokenizer tokenizer) { this.hereDocLabel = tokenizer.hereDocLabel; this.currentState = tokenizer.CurrentLexicalState; this.stateStack = tokenizer.StateStack.ToArray(); }
public void Initialize(System.IO.TextReader reader, LexicalStates lexicalState) { Initialize(reader, lexicalState, false); }
private void yy_push_state(LexicalStates state) { stateStack.Push(current_lexical_state); current_lexical_state = state; }
/// <summary> /// Override of <c>Initialize</c> resetting <see cref="_charOffset"/> so <see cref="TokenPosition"/> is correctly shifted. /// </summary> public void Initialize(System.IO.TextReader reader, LexicalStates lexicalState, bool atBol, int positionShift) { Initialize(reader, lexicalState, atBol); _charOffset = positionShift; }
#pragma warning restore 162 #endregion private void BEGIN(LexicalStates state) { current_lexical_state = state; }
private bool yy_pop_state() { if (stateStack.Count == 0) return false; current_lexical_state = stateStack.Pop(); return true; }