public ModifiedSpell(Spell s, IEnumerable <Keyword> kwToAdd, Ability ability = Ability.None, RechargeModifier recharge = RechargeModifier.Unmodified)
 {
     Name     = s.Name;
     Keywords = s.Keywords;
     if (kwToAdd != null)
     {
         AdditionalKeywords = new List <Keyword>(kwToAdd);
     }
     else
     {
         AdditionalKeywords = new List <Keyword>();
     }
     Level            = s.Level;
     CastingTime      = s.CastingTime;
     Range            = s.Range;
     Duration         = s.Duration;
     Description      = s.Description;
     Descriptions     = s.Descriptions;
     differentAbility = ability;
     RechargeModifier = recharge;
     AdditionalKeywords.RemoveAll(k => Keywords.Contains(k));
     AddAlwaysPreparedToName = false;
     Source                = s.Source;
     CantripDamage         = s.CantripDamage;
     used                  = 0;
     FormsCompanionsFilter = s.FormsCompanionsFilter;
     FormsCompanionsCount  = s.FormsCompanionsCount;
     displayShort          = false;
     Modifikations         = new List <Feature>();
     count                 = 1;
 }
 public ModifiedSpell(Spell s, bool onlyAsRitual)
 {
     Name               = s.Name;
     Keywords           = s.Keywords;
     AdditionalKeywords = new List <Keyword>();
     Level              = s.Level;
     CastingTime        = s.CastingTime;
     Range              = s.Range;
     Duration           = s.Duration;
     Description        = s.Description;
     Descriptions       = s.Descriptions;
     differentAbility   = Ability.None;
     RechargeModifier   = RechargeModifier.Unmodified;
     AdditionalKeywords.RemoveAll(k => Keywords.Contains(k));
     AddAlwaysPreparedToName = false;
     Source                = s.Source;
     CantripDamage         = s.CantripDamage;
     used                  = 0;
     displayShort          = false;
     Modifikations         = new List <Feature>();
     this.includeResources = false;
     includeRecharge       = includeResources;
     OnlyAsRitual          = true;
     FormsCompanionsFilter = s.FormsCompanionsFilter;
     FormsCompanionsCount  = s.FormsCompanionsCount;
     count                 = 1;
 }
 public ModifiedSpell(Spell s, IEnumerable <Keyword> kwToAdd, bool addAlwaysPreparedToName, bool includeResources = true)
 {
     Name     = s.Name;
     Keywords = s.Keywords;
     if (kwToAdd != null)
     {
         AdditionalKeywords = new List <Keyword>(kwToAdd);
     }
     else
     {
         AdditionalKeywords = new List <Keyword>();
     }
     Level            = s.Level;
     CastingTime      = s.CastingTime;
     Range            = s.Range;
     Duration         = s.Duration;
     Description      = s.Description;
     Descriptions     = s.Descriptions;
     differentAbility = Ability.None;
     RechargeModifier = RechargeModifier.Unmodified;
     AdditionalKeywords.RemoveAll(k => Keywords.Contains(k));
     AddAlwaysPreparedToName = addAlwaysPreparedToName;
     Source                = s.Source;
     CantripDamage         = s.CantripDamage;
     used                  = 0;
     displayShort          = false;
     Modifikations         = new List <Feature>();
     this.includeResources = includeResources;
     includeRecharge       = includeResources;
     count                 = 1;
 }
Example #4
0
        /// <summary>
        /// Determines whether a given string is a valid identifier.
        /// </summary>
        /// <param name="identifier">A string to test.</param>
        /// <returns><c>true</c> if <paramref name="identifier"/> is a valid identifier; otherwise, <c>false</c>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="identifier"/> is <c>null</c>, empty or whitespace</exception>
        protected static bool IsValidIdentifier(string identifier)
        {
            if (identifier.IsNullOrWhiteSpace())
            {
                throw new ArgumentNullException(nameof(identifier));
            }

            if (Keywords.Contains(identifier))
            {
                return(false);
            }

            var firstChar        = identifier[0];
            var isValidFirstChar = firstChar == '_' || firstChar.IsLetter();

            if (!isValidFirstChar)
            {
                return(false);
            }

            var restChars = identifier.Skip(1).ToList();

            if (restChars.Empty())
            {
                return(true);
            }

            return(restChars
                   .Select(c => c.GetUnicodeCategory())
                   .All(ValidPartCategories.Contains));
        }
Example #5
0
        public static void HighLightKeywords(TextBlock block, string inputString)
        {
            var model = block.DataContext as SearchResultModel;

            if (model != null && model.Type == RESOURCE_LOADER.GetString("Publication"))
            {
                block.Text = inputString;
            }
            else
            {
                var stringSplit = Regex.Split(inputString, Pattern);
                if (block.Inlines.Count > 0)
                {
                    block.Inlines.Clear();
                }
                foreach (var subString in stringSplit)
                {
                    if (string.IsNullOrEmpty(subString))
                    {
                        continue;
                    }
                    Run value = new Run();
                    if (Keywords.Contains(subString))
                    {
                        value.FontWeight = FontWeights.Bold;
                    }
                    value.Text = subString;
                    block.Inlines.Add(value);
                }
            }
        }
Example #6
0
        private void CheckIdentifier(Token token)
        {
            if (token != null && token.Type == TokenType.Identifier)
            {
                double result;

                if (double.TryParse(token.Text, out result))
                {
                    token.Type = TokenType.Numeric;

                    if (tokens.Count > 1)
                    {
                        Token previousToken = tokens[tokens.Count - 2];

                        if (previousToken != null && previousToken.Type == TokenType.Symbol && previousToken.Text.Equals("-", StringComparison.InvariantCulture))
                        {
                            tokens.Remove(previousToken);
                            token.Position--;
                            token.Text = "-" + token.Text;
                        }
                    }
                }
                else if (Keywords.Contains(token.Text))
                {
                    token.Type = TokenType.Keyword;
                }
            }
        }
Example #7
0
        public int GetRelevance(string userInput)
        {
            if (Title.Contains(userInput))
            {
                return(6);
            }
            else if (Title.Contains(userInput, StringComparison.OrdinalIgnoreCase))
            {
                return(5);
            }
            else if (Regex.IsMatch(Title, GetPattern(userInput)))
            {
                return(4);
            }
            else if (Regex.IsMatch(Title, GetPattern(userInput), RegexOptions.IgnoreCase))
            {
                return(3);
            }
            else if (Keywords.Contains(userInput))
            {
                return(2);
            }
            else if (Keywords.Contains(userInput, StringComparison.OrdinalIgnoreCase))
            {
                return(1);
            }

            return(0);
        }
Example #8
0
        protected void ParseIdentifier(int start)
        {
            if (IsCurrentCharacterIdentifierStartCharacter)
            {
                while (CharsLeft > 0)
                {
                    AdvanceAndRecognize();

                    if (!IsCurrentCharacterIdentifierPartCharacter)
                    {
                        Index--; // rewind back to last character.
                        break;
                    }
                }

                var identifier = new string(Text, start, (Index - start) + 1);
                AddToken(new Token {
                    Type = Keywords.Contains(identifier) ? TokenType.Keyword : TokenType.Identifier,
                    Data = identifier
                });
                return;
            }

            AddToken(new Token {
                Type = TokenType.Unknown,
                Data = CurrentCharacter
            });
        }
Example #9
0
        void ReadIdentifier()
        {
            var accum = new StringBuilder();
            var c     = source.Peek();

            while (char.IsLetterOrDigit(c) || c == '_')
            {
                accum.Append(c);
                if (!source.See())
                {
                    break;
                }
                source.Skip();
                c = source.Peek();
            }
            var str = accum.ToString();

            if (Keywords.Contains(str))
            {
                lexemes.Add(new Lexeme(TokenClass.Keyword, source, str));
                return;
            }
            if (OperatorStrings.Contains(str))
            {
                lexemes.Add(new Lexeme(TokenClass.Operator, source, str));
                return;
            }
            lexemes.Add(new Lexeme(TokenClass.Identifier, source, str));
        }
Example #10
0
        public override void Add(Token token)
        {
            if (_newAssign)
            {
                if (token.TokenType != TokenType.Control || token.TokenString != ":=")
                {
                    throw new InvalidSyntaxException($"Expected assignment. Got {token.TokenString}", token.Line, token.Position);
                }
                _newAssign = false;
                return;
            }
            _line = token.Line;
            _pos  = token.Position;
            if (token.TokenType == TokenType.Control && token.TokenString.Equals(";"))
            {
                if (_current == null)
                {
                    throw new InvalidSyntaxException("Empty statement. Nothing to terminate", token.Line, token.Position);
                }

                if (!_current.Exit())
                {
                    return;
                }
                if (_current is Definition definition)
                {
                    Scope.Add(definition.Name, _subparts.Count);
                }
                _subparts.Add(_current);
                _current = null;
                return;
            }
            if (_current != null)
            {
                _current.Add(token);
                return;
            }

            if (token.TokenType != TokenType.Name)
            {
                throw new InvalidSyntaxException("Expected keyword or variable identifier", token.Line, token.Position);
            }

            if (Keywords.Contains(token.TokenString))
            {
                AddKey(token);
                return;
            }

            if (!Scope.ContainsKey(token.TokenString))
            {
                throw new InvalidSyntaxException($"Use of undeclared variable {token.TokenString}", token.Line, token.Position);
            }

            _current   = new Assignment((Definition)_subparts[Scope[token.TokenString]], this, token.Line, token.Position);
            _newAssign = true;
            _subparts.Add(_current);
        }
Example #11
0
        /// <summary>
        /// Determines whether the given text is a reserved keyword.
        /// </summary>
        /// <param name="text">A piece of text.</param>
        /// <returns><c>true</c> if the given text is a reserved keyword; otherwise, <c>false</c>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="text"/> is <c>null</c>, empty or whitespace.</exception>
        public override bool IsReservedKeyword(string text)
        {
            if (text.IsNullOrWhiteSpace())
            {
                throw new ArgumentNullException(nameof(text));
            }

            return(Keywords.Contains(text));
        }
Example #12
0
        string[] SplitKeywords()
        {
            if (Keywords.Contains(','))
            {
                return(Keywords.Split(',').Where(x => !string.IsNullOrWhiteSpace(x)).Select(x => x.Trim()).ToArray());
            }

            return(Keywords.Split(' ').Where(x => !string.IsNullOrWhiteSpace(x)).Select(x => x.Trim()).ToArray());
        }
Example #13
0
        /// <summary>
        /// Returns whether any of the specified values is an SQLite reserved keyword.
        /// </summary>
        /// <param name="values"></param>
        /// <returns></returns>
        private static bool ContainsKeyword(string[] values)
        {
            foreach (var key in values)
            {
                if (Keywords.Contains(key))
                {
                    return(true);
                }
            }

            return(false);
        }
 /// <summary>
 /// Creates a parser for an identifier that isn't a keyword
 /// </summary>
 /// <returns></returns>
 public static IParser <char, string> AvailableIdentifier()
 {
     //  available-identifier:
     //    An identifier-or-keyword that is not a keyword
     return(IdentifierOrKeyWord()
            .Select(parse => {
         if (Keywords.Contains(parse.Node))
         {
             return parse.WithError(
                 new Exception("Identifier '{0}' is a keyword. use '@{0}'".Interpolate(parse.Node)));
         }
         return parse;
     }));
 }
Example #15
0
 public String GetEscapedIdentifier(String Identifier)
 {
     return(rIdentifierPart.Replace(Identifier, m =>
     {
         var IdentifierPart = m.Value;
         if (Keywords.Contains(IdentifierPart))
         {
             return "[" + IdentifierPart + "]";
         }
         else
         {
             return IdentifierPart;
         }
     }).Replace("<", "(Of ").Replace(">", ")"));
 }
Example #16
0
 public String GetEscapedIdentifier(String Identifier)
 {
     return(rIdentifierPart.Replace(Identifier, m =>
     {
         var IdentifierPart = m.Value;
         if (Keywords.Contains(IdentifierPart))
         {
             return "@" + IdentifierPart;
         }
         else
         {
             return IdentifierPart;
         }
     }));
 }
Example #17
0
 public static GlslTokenTypes AssignType(string word)
 {
     if (Keywords.Contains(word))
     {
         return(GlslTokenTypes.Keyword);
     }
     if (Functions.Contains(word))
     {
         return(GlslTokenTypes.Function);
     }
     if (Variables.Contains(word))
     {
         return(GlslTokenTypes.Variable);
     }
     return(GlslTokenTypes.Identifier);
 }
Example #18
0
        private void CheckIdentifier(Token token)
        {
            if (token != null && token.Type == TokenType.Identifier)
            {
                double result;

                if (double.TryParse(token.Text, out result))
                {
                    token.Type = TokenType.Numeric;
                }
                else if (Keywords.Contains(token.Text))
                {
                    token.Type = TokenType.Keyword;
                }
            }
        }
        private void LoadAbility(string system, string job, string abil)
        {
            GrimoireAbility ability = GrimoireHandler.Ability(system, job, abil);

            AbilityName = ability.Name;
            SlotCost    = ability.SlotCost;
            Notes       = ability.Notes;
            DeactivateKeywords();
            Keywords = ability.Keywords;
            ActivateKeywords();
            AbilityType = ability.AbilityType;
            Element     = ability.Element;
            if (AbilityType == AbilityType.Action)
            {
                if (Keywords.Contains(Keyword.Weapon))
                {
                    DelayMod        = ability.Delay;
                    FloorMod        = ability.Floor;
                    MP              = ability.MP;
                    MPPerTier       = ability.MPPerTier;
                    CT              = ability.CT;
                    CoSMod          = ability.CoS;
                    TargetType      = ability.Target;
                    DieMod          = ability.Dice;
                    DieModPerTier   = ability.DicePerTier;
                    PowerMod        = ability.Power;
                    PowerModPerTier = ability.PowerPerTier;
                    PowerMultiplier = ability.Multiplier;
                }
                else
                {
                    Delay        = ability.Delay;
                    Floor        = ability.Floor;
                    MP           = ability.MP;
                    MPPerTier    = ability.MPPerTier;
                    CT           = ability.CT;
                    CoS          = ability.CoS;
                    TargetType   = ability.Target;
                    DieType      = ability.DieType;
                    AttackType   = ability.AttackType;
                    Dice         = ability.Dice;
                    DicePerTier  = ability.DicePerTier;
                    BasePower    = ability.Power;
                    PowerPerTier = ability.PowerPerTier;
                }
            }
        }
Example #20
0
            private Token Scan()
            {
                int length = _text.Length;

                while (_offset < length && char.IsWhiteSpace(_text[_offset]))
                {
                    _offset++;
                }

                if (_offset == length)
                {
                    return(new Token(TokenKind.End));
                }

                int n = ScanIdentifier();

                if (n > 0)
                {
                    var text = _text.Substring(_offset, n);
                    _offset += n;
                    if (Keywords.Contains(text))
                    {
                        var keywordKind = SyntaxKind.None;
                        KeywordKinds.TryGetValue(text, out keywordKind);
                        return(new Token(TokenKind.Keyword, text, keywordKind));
                    }
                    return(new Token(TokenKind.Identifier, text));
                }

                var c = _text[_offset++];

                if (c == '[')
                {
                    n = ScanIdentifier();
                    if (n > 0 && _offset + n < length && _text[_offset + n] == ']')
                    {
                        // A verbatim identifier. Treat the '[' and ']' as part
                        // of the token, but not part of the text.
                        var text = _text.Substring(_offset, n);
                        _offset += n + 1;
                        return(new Token(TokenKind.Identifier, text));
                    }
                }

                return(new Token((TokenKind)c));
            }
Example #21
0
        public static bool Classify(ULanguageTokenTypes tokenType, SnapshotSpan current, IClassificationType tag, ref List <ClassificationSpan> res)
        {
            bool found = false;

            switch (tokenType)
            {
            case ULanguageTokenTypes.Keyword:
            {
                if (Keywords.Contains(current.GetText()))
                {
                    res.Add(new ClassificationSpan(current, tag));
                    found = true;
                }
            }
            break;
            }
            return(found);
        }
Example #22
0
        protected void keyword_Command(object sender, CommandEventArgs e)
        {
            if (string.Equals(e.CommandName, "Keyword", StringComparison.OrdinalIgnoreCase))
            {
                string word = e.CommandArgument as string;

                if (!string.IsNullOrEmpty(word))
                {
                    if (!Keywords.Contains(word))
                    {
                        Keywords.Add(word);
                    }

                    keywordsListPanel.Visible = false;
                    KeywordFirstLetter        = null;
                }
            }
        }
Example #23
0
        private void SetName(Token token)
        {
            if (token.TokenType != TokenType.Name)
            {
                throw new InvalidSyntaxException("Expected a name after variable declaration", token.Line, token.Position);
            }
            if (Keywords.Contains(token.TokenString))
            {
                throw new InvalidSyntaxException($"Unable to re-define reserved keyword {token.TokenString}", token.Line, token.Position);
            }
            Definition d = GetDefinition(token.TokenString);

            if (d != null)
            {
                throw new InvalidSyntaxException($"Unable to re-define variable {token.TokenString}", token.Line, token.Position);
            }
            Name   = token.TokenString;
            _state = DState.Named;
        }
Example #24
0
 public override void Add(Token token)
 {
     if (_def != null)
     {
         throw new InvalidSyntaxException($"Expected line terminator. Got {token.TokenString}", token.Line, token.Position);
     }
     if (token.TokenType != TokenType.Name)
     {
         throw new InvalidSyntaxException($"Expected variable identifier. Got {token.TokenString}", token.Line, token.Position);
     }
     if (Keywords.Contains(token.TokenString))
     {
         throw new InvalidSyntaxException($"{token.TokenString} is not a valid variable identifier", token.Line, token.Position);
     }
     _def = GetDefinition(token.TokenString);
     if (_def == null)
     {
         throw new InvalidSyntaxException($"Use of uninitialized variable {token.TokenString}", token.Line, token.Position);
     }
 }
Example #25
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!Page.IsPostBack)
            {
                string query = Request.QueryString["q"];

                if (!string.IsNullOrEmpty(query))
                {
                    QueryExpressionFactory factory = new QueryExpressionFactory();
                    factory.DefaultOperator      = '&';
                    factory.SplitQueryCharacters = DaveSexton.DocProject.DocSites.DocSiteSearch.DefaultSearchProvider.SplitQueryCharacters;
                    factory.IgnoredWords         = DocSiteManager.Settings.SearchExcludedKeywords.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    factory.MinimumKeywordLength = DocSiteManager.Settings.SearchMinimumKeywordLength;
                    factory.Optimize             = false;

                    QueryExpression expression = factory.CreateExpression(query);

                    if (!(expression is EmptyQueryExpression))
                    {
                        expression.Evaluate(delegate(QueryExpression expr)
                        {
                            TermQueryExpression term = expr as TermQueryExpression;

                            if (term != null && !Keywords.Contains(term.Term))
                            {
                                Keywords.Add(term.Term);
                            }
                        });
                    }

                    // The index must always be created when a query is specified otherwise it will be generated
                    // automatically _after_ the keywords are rendered, which means they'll all appear in "red".
                    DaveSexton.DocProject.DocSites.DocSiteSearch.EnsureIndex();

                    keywordsListPanel.Visible = false;
                    KeywordFirstLetter        = null;
                }
            }
        }
Example #26
0
 private void EmptyState(Token token)
 {
     if (token.TokenType != TokenType.Name)
     {
         throw new InvalidSyntaxException($"Expected loop variable id. Got {token.TokenString}", token.Line, token.Position);
     }
     if (Keywords.Contains(token.TokenString))
     {
         throw new InvalidSyntaxException($"Loop variable can not be a reserved keyword. Got {token.TokenString}", token.Line, token.Position);
     }
     _loopvar = GetDefinition(token.TokenString);
     if (_loopvar == null)
     {
         throw new InvalidSyntaxException($"Use of undefined variable as loop variable. {token.TokenString}", token.Line, token.Position);
     }
     if (!(_loopvar.GetValue() is MplInteger))
     {
         throw new InvalidSyntaxException($"Loop variable {token.TokenString} is not an integer", token.Line, token.Position);
     }
     _state = LState.Variabled;
 }
Example #27
0
        static bool IsKeyword(string value, bool anyDoubleUnderscore)
        {
            // Identifiers that start with double underscore are meant to be used for reserved keywords.
            // Only existing keywords are enforced, but it may be useful to forbid any identifier
            // that begins with double underscore to prevent issues with future C# versions.
            if (anyDoubleUnderscore)
            {
                if (value.Length > 2 && value[0] == '_' && value[1] == '_' && value[2] != '_')
                {
                    return(true);
                }
            }
            else
            {
                if (DoubleUnderscoreKeywords.Contains(value))
                {
                    return(true);
                }
            }

            return(Keywords.Contains(value));
        }
Example #28
0
 internal virtual string GetFullPrompt()
 {
     if (Keywords.Count == 0)
     {
         return(Message.TrimEnd(' ', ':') + ": ");
     }
     else
     {
         StringBuilder sb = new StringBuilder(Message.TrimEnd(' ', ':'));
         sb.Append(" [");
         sb.Append(string.Join(", ", Keywords));
         sb.Append("]");
         if (Keywords.Contains(DefaultKeyword))
         {
             sb.Append(" <");
             sb.Append(DefaultKeyword);
             sb.Append(">");
         }
         sb.Append(": ");
         return(sb.ToString());
     }
 }
Example #29
0
        private void BodyState(Token token)
        {
            if (_newAssign)
            {
                if (token.TokenType != TokenType.Control || token.TokenString != ":=")
                {
                    throw new InvalidSyntaxException($"Expected assignment. Got {token.TokenString}", token.Line, token.Position);
                }
                _newAssign = false;
                return;
            }
            if (_current != null)
            {
                _current.Add(token);
                return;
            }

            if (token.TokenType != TokenType.Name)
            {
                throw new InvalidSyntaxException("Expected keyword or variable identifier", token.Line, token.Position);
            }

            if (Keywords.Contains(token.TokenString))
            {
                AddKey(token);
                return;
            }

            Definition def = GetDefinition(token.TokenString);

            if (def == null)
            {
                throw new InvalidSyntaxException($"Use of undeclared variable {token.TokenString}", token.Line, token.Position);
            }

            _current   = new Assignment(def, this, token.Line, token.Position);
            _newAssign = true;
        }
Example #30
0
        private void Style(int linenum, int end)
        {
            int line_length = SendMessageDirect(Constants.SCI_LINELENGTH, linenum);
            int start_pos   = SendMessageDirect(Constants.SCI_POSITIONFROMLINE, linenum);
            int laststyle   = start_pos;

            Cpp stylingMode;

            if (start_pos > 0)
            {
                stylingMode = (Cpp)GetStyleAt(start_pos - 1);
            }
            else
            {
                stylingMode = Cpp.Default;
            }
            bool onNewLine    = true;
            bool onScriptLine = false;
            int  i;

            SendMessageDirect(Constants.SCI_STARTSTYLING, start_pos, 0x1f);

            for (i = start_pos; i <= end; i++)
            {
                char c = (char)GetCharAt(i);

                if (!Char.IsLetterOrDigit(c) && (stylingMode != Cpp.Comment || stylingMode != Cpp.CommentLine || stylingMode != Cpp.String))
                {
                    string lastword = previousWordFrom(i);
                    if (lastword.Length != 0)
                    {
                        Cpp newMode = stylingMode;
                        if (onScriptLine && Keywords.Contains(lastword.Trim()))
                        {
                            newMode = Cpp.Word;
                        }
                        if (!onScriptLine && stylingMode == Cpp.Word2) // before colon
                        {
                            if (lastword.Trim() == "return" || lastword.Trim() == "stop")
                            {
                                newMode = Cpp.Word;
                            }
                        }


                        if (newMode != stylingMode)
                        {
                            SendMessageDirect(Constants.SCI_SETSTYLING, i - laststyle - lastword.Length, (int)stylingMode);
                            SendMessageDirect(Constants.SCI_SETSTYLING, lastword.Length, (int)newMode);
                            laststyle = i;
                        }
                    }
                }

                if (c == '\n')
                {
                    onNewLine    = true;
                    onScriptLine = false;
                    if (stylingMode != Cpp.Comment && stylingMode != Cpp.String)
                    {
                        if (laststyle < i)
                        {
                            SendMessageDirect(Constants.SCI_SETSTYLING, i - laststyle, (int)stylingMode);
                            laststyle = i;
                        }
                        stylingMode = Cpp.Default;
                    }
                    continue;
                }

                if (onNewLine)
                {
                    if (c == ' ')
                    {
                        onScriptLine = true;
                        onNewLine    = false;
                        continue;
                    }
                }

                if (onScriptLine)
                {
                    if (isOperator(c))
                    {
                        if (stylingMode != Cpp.String && stylingMode != Cpp.Comment && stylingMode != Cpp.CommentLine)
                        {
                            SendMessageDirect(Constants.SCI_SETSTYLING, i - laststyle, (int)stylingMode);
                            SendMessageDirect(Constants.SCI_SETSTYLING, 1, (int)Cpp.Operator);
                            stylingMode = Cpp.Default;
                            laststyle   = i + 1;
                        }
                    }

                    else if (isNumeric(c))
                    {
                        if (stylingMode != Cpp.String && stylingMode != Cpp.Comment && stylingMode != Cpp.CommentLine)
                        {
                            SendMessageDirect(Constants.SCI_SETSTYLING, i - laststyle, (int)stylingMode);
                            SendMessageDirect(Constants.SCI_SETSTYLING, 1, (int)Cpp.Number);
                            stylingMode = Cpp.Default;
                            laststyle   = i + 1;
                        }
                    }
                    else if (c == '"')
                    {
                        if (stylingMode == Cpp.String)
                        {
                            SendMessageDirect(Constants.SCI_SETSTYLING, i - laststyle + 1, (int)stylingMode);
                            laststyle   = i + 1;
                            stylingMode = Cpp.Default;
                        }
                        else
                        {
                            stylingMode = Cpp.String;
                        }
                    }
                }
                else
                {
                    if (onNewLine && stylingMode != Cpp.Comment)
                    {
                        SendMessageDirect(Constants.SCI_SETSTYLING, i - laststyle, (int)stylingMode);
                        stylingMode = Cpp.Word2;
                        laststyle   = i;
                    }
                    if (c == ':' && stylingMode != Cpp.Comment && stylingMode != Cpp.CommentLine)
                    {
                        SendMessageDirect(Constants.SCI_SETSTYLING, i - laststyle + 1, (int)stylingMode);
                        laststyle   = i + 1;
                        stylingMode = Cpp.Number;
                    }
                    if (c == '@' && stylingMode == Cpp.Word2)
                    {
                        SendMessageDirect(Constants.SCI_SETSTYLING, i - laststyle, (int)stylingMode);
                        stylingMode = Cpp.Number;
                        laststyle   = i;
                    }
                }

                if (c == '/')
                {
                    if (stylingMode == Cpp.Comment && GetCharAt(i - 1) == '*')
                    {
                        SendMessageDirect(Constants.SCI_SETSTYLING, i - laststyle + 1, (int)stylingMode);
                        stylingMode = Cpp.Default;
                        laststyle   = i + 1;
                    }
                    else if (GetCharAt(i + 1) == '*' && onScriptLine)
                    {
                        SendMessageDirect(Constants.SCI_SETSTYLING, i - laststyle, (int)stylingMode);
                        stylingMode = Cpp.Comment;
                        laststyle   = i;
                    }
                    else if (GetCharAt(i + 1) == '/')
                    {
                        SendMessageDirect(Constants.SCI_SETSTYLING, i - laststyle, (int)stylingMode);
                        stylingMode = Cpp.CommentLine;
                        laststyle   = i;
                    }
                }

                onNewLine = false;
            }



            SendMessageDirect(Constants.SCI_SETSTYLING, i - laststyle, (int)stylingMode);
        }