Package com.Ostermiller.Syntax.Lexer

Examples of com.Ostermiller.Syntax.Lexer.Token


        if (colorStartPos != -1)
        {
          try
          {
            final SchemaInfo si = _session.getSchemaInfo();
            Token t;
            synchronized (doclock)
            {
              // we are playing some games with the lexer for efficiency.
              // we could just create a new lexer each time here, but instead,
              // we will just reset it so that it thinks it is starting at the
              // beginning of the document but reporting a funny start colorStartPos.
              // Reseting the lexer causes the close() method on the reader
              // to be called but because the close() method has no effect on the
              // DocumentReader, we can do this.
              syntaxLexer.reset(
                documentReader,
                0,
                colorStartPos,
                0);
              // After the lexer has been set up, scroll the reader so that it
              // is in the correct spot as well.
              documentReader.seek(colorStartPos);
              // we will highlight tokens until we reach a good stopping place.
              // the first obvious stopping place is the end of the document.
              // the lexer will return null at the end of the document and wee
              // need to stop there.
              t = getNextToken();
            }
                  SimpleAttributeSet errStyle = getMyStyle(IConstants.IStyleNames.ERROR);
                  ErrorInfo[] errInfoClone = _currentErrorInfos.toArray(new ErrorInfo[0]);
            while (t != null && t.getCharEnd() <= colorStartPos + colorLen + 1)
            {
              // this is the actual command that colors the stuff.
              // Color stuff with the description of the style matched
              // to the hash table that has been set up ahead of time.
              synchronized (doclock)
              {
                if (t.getCharEnd() <= document.getLength())
                {
                  String type = t.getDescription();
                  if (type.equals(IConstants.IStyleNames.IDENTIFIER))
                  {
                    final String data = t.getContents();
                    if (si.isTable(data))
                    {
                      type = IConstants.IStyleNames.TABLE;
                                 if(fireTableOrViewFoundEvent)
                                 {
                         fireTableOrViewFound(t.getContents());
                       }

                                 String upperCaseTableName = data.toUpperCase();
                                 if(false == _knownTables.contains(upperCaseTableName))
                                 {
                                    _knownTables.put(upperCaseTableName, upperCaseTableName);
                                    recolorColumns(upperCaseTableName);
                                 }

                    }
                    else if (si.isColumn(data))
                    {
                      type = IConstants.IStyleNames.COLUMN;
                    }
                    else if (si.isDataType(data))
                    {
                      type = IConstants.IStyleNames.DATA_TYPE;
                    }
                    else if (si.isKeyword(data))
                    {
                      type = IConstants.IStyleNames.RESERVED_WORD;
                    }
                  }

                           int begin = t.getCharBegin();
                           int len = t.getCharEnd() - t.getCharBegin();

                           SimpleAttributeSet myStyle = null;
                           for (int i = 0; i < errInfoClone.length; i++)
                           {
                              if (    isBetween(errInfoClone[i].beginPos, errInfoClone[i].endPos, begin)
View Full Code Here

TOP

Related Classes of com.Ostermiller.Syntax.Lexer.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.