Examples of Token


Examples of org.jruby.util.RubyDateFormatter.Token

        stringBuf.setLength(0);
        return Token.str(str);
    }

    public Token directive(char c) {
        Token token;
        if (c == 'z') {
            int colons = yylength()-1; // can only be colons except the 'z'
            return Token.zoneOffsetColons(colons);
        } else if ((token = Token.format(c)) != null) {
            return token;
View Full Code Here

Examples of org.jstripe.tokenizer.Token

        String thisLineSeparator = lastLineSeparator;
        lastLineSeparator = null;

        if (tokenizer.hasMore()) {
            while (tokenizer.hasMore()) {
                Token tk = tokenizer.nextToken();
                if (LINE_SEPARATOR.equals(tk.getName())) {
                    lastLineSeparator = tk.getText();
                    break;
                } else {
                    result = tk.getText();
                }
            }
        } else if (thisLineSeparator == null) {
            result = null;
        }
View Full Code Here

Examples of org.jwall.log.io.ParserGenerator.Token

        this.reset();
        Map<String,String> reads = new LinkedHashMap<String,String>();
        reads.putAll( defaults );

        for( int i = 0; i < tokens.size(); i++ ){
            Token token = tokens.get( i );
            Token next = null;
            if( i+1 < tokens.size() )
                next = tokens.get( i + 1 );
            //skipBlanks( str );
            log.debug( "Remainder string: '{}'", remainder( str ) );

            if( !token.isVariable() ){
                log.debug( "Next token is a constant '{}'", token.getValue() );
                int start = pos;

                if( token.isRegex() ){
                    int len = token.skipLength( remainder( str ) );
                    this.pos += len;
                } else {
                    String val = prefix( str, token.getValue().length() );
                    log.debug( "   const read: '{}'", val );
                    if( !token.getValue().equals( val ) )
                        throw new ParseException( "Failed to read '" + token.getValue() + "', found: " + val + " at position " + start );
                    else
                        this.pos += token.getValue().length();
                }
            } else {
                log.debug( "Next token is a variable '{}'", token.getValue() );
                String val = null;

                if( token.isRegex() ){
                    String rem = remainder( str );
                    int len = token.skipLength( rem );
                    val = rem.substring( 0, len );
                    this.pos += len;
                    reads.put( token.getName(), val );
                } else {
                    if( next != null && !next.isVariable() )
                        val = readTokenUntil( str, next.getValue() );
                    else {
                        if( next == null )
                            val = remainder( str );
                        else
                            val = readToken( str );
View Full Code Here

Examples of org.jwebsocket.token.Token

      // get the server time
      if ("requestServerTime".equals(lType)) {
        // create the response token
        // this includes the unique token-id
        Token lResponse = createResponse(aToken);

        // add the "time" and "started" field
        lResponse.put("time", new Date().toString());
        lResponse.put("started", aConnector.getVar(SAMPLE_VAR));

        // put an array into the token
        lResponse.put("array", new Object[]{1, 2, 3, 'a', 'b', 'c', "ABC", "XYZ", true, false});

        // put a map into the token
        Map lMap = new FastMap();
        lMap.put("MapItem1", 1);
        lMap.put("MapItem2", 2);
        lResponse.put("map", lMap);

        List lList = new FastList();
        lList.add("ListItem1");
        lList.add("ListItem2");
        lResponse.put("list", lList);

        // put a token into a token
        Token lToken = new Token();
        lToken.put("number", 1);
        lToken.put("string", "test");
        lToken.put("float", 1.23456);
        lToken.put("boolean", false);
        lToken.put("array", new Object[]{4, 5, 6, 'd', 'e', 'f', "DEF", "UVW", false, true});

        // insert subtoken, another level in object's hierarchy...
        Token lSubToken = new Token();
        lSubToken.put("number", 2);
        lSubToken.put("string", "demo");
        lSubToken.put("float", 2.34567);
        lSubToken.put("boolean", true);
        lSubToken.put("array", new Object[]{7, 8, 9, 'g', 'h', 'i', "GHI", "RST", true, false});
        lToken.put("subtoken", lSubToken);

        // put the token incl. its subtoken into the response
        lResponse.put("token", lToken);
View Full Code Here

Examples of org.lilypondbeans.jccparser.Token

                ParseException syntaxError = syntaxErrors.get(px);
                Logger logger = Logger.getLogger(SyntaxErrorsHighlightingTask.class.getName());

              //  Exceptions.printStackTrace(syntaxError);

                Token token = syntaxError.currentToken;
                String msg = syntaxError.getMessage();
                boolean isHint = false;
                if (syntaxError instanceof ReparseException) {
                    ReparseException pex = (ReparseException) syntaxError;
                    pex = pex.expandIncludedFile();
View Full Code Here

Examples of org.maltparserx.core.syntaxgraph.node.Token

 
  public Sentence(SymbolTableHandler symbolTables) throws MaltChainedException {
    super(symbolTables);
    terminalNodes = new TreeMap<Integer,Token>();
    terminalPool = new ObjectPoolList<Token>() {
      protected Token create() throws MaltChainedException { return new Token(); }
      public void resetObject(Token o) throws MaltChainedException { o.clear(); }
    };
  }
View Full Code Here

Examples of org.naturalcli.Token

   * Test method for {@link org.naturalcli.Token#isOptional()}.
   */
  @Test
  public final void testSetText() throws InvalidTokenException {
    // ok
    new Token("marian");
    new Token("<marian>");
    new Token("[marian]");
    new Token("[<marian>]");
    // not ok
    try { new Token("marian]"); fail(); } catch (InvalidTokenException e) { }
    try { new Token("marian>"); fail(); } catch (InvalidTokenException e) { }
    try { new Token("marian>]"); fail(); } catch (InvalidTokenException e) { }
    try { new Token("<marian"); fail(); } catch (InvalidTokenException e) { }
    try { new Token("<marian]"); fail(); } catch (InvalidTokenException e) { }
    try { new Token("<marian>]"); fail(); } catch (InvalidTokenException e) { }
    try { new Token("<[marian"); fail(); } catch (InvalidTokenException e) { }
    try { new Token("<[marian>"); fail(); } catch (InvalidTokenException e) { }
    try { new Token("<[marian>]"); fail(); } catch (InvalidTokenException e) { }
    try { new Token("[marian"); fail(); } catch (InvalidTokenException e) { }
    try { new Token("[marian>"); fail(); } catch (InvalidTokenException e) { }
    try { new Token("[marian>]"); fail(); } catch (InvalidTokenException e) { }
    try { new Token(""); fail(); } catch (InvalidTokenException e) { }
    try { new Token(null); fail(); } catch (InvalidTokenException e) { }
  }
View Full Code Here

Examples of org.netbeans.api.lexer.Token

        AbstractDocument doc = (AbstractDocument) context.getDocument();
        doc.readLock();
        try {
            TokenHierarchy th = TokenHierarchy.get(doc);
            TokenSequence ts = th.tokenSequence();
            Token token = findTokenAtContext(ts, context.getSearchOffset());
            if (token == null) {
                return null;
            }
            int ordinal = token.id().ordinal();
            for (BracePair bp : bracePairs) {
                if (ordinal == bp.open) {
                    originToken = bp.open;
                    matchToken = bp.close;
                    searchForward = true;
                    ret = new int[]{ts.offset(), ts.offset() + token.length()};
                } else if (ordinal == bp.close) {
                    originToken = bp.close;
                    matchToken = bp.open;
                    searchForward = false;
                    ret = new int[]{ts.offset(), ts.offset() + token.length()};
                }
            }
        } finally {
            ((AbstractDocument) context.getDocument()).readUnlock();
        }
View Full Code Here

Examples of org.ofbiz.base.json.Token

        } catch (ParseException e) {
            caught = e;
        } finally {
            assertNotNull("caught exception", caught);
            assertNotNull("next token(" + s + ")", caught.currentToken);
            Token next = caught.currentToken.next;
            assertEquals("next token(" + s + ") is eof", 0, next.kind);
            assertEquals("begin line(" + s + ")", 1, next.beginLine);
            assertEquals("begin column(" + s + ")", column, next.beginColumn);
        }
    }
View Full Code Here

Examples of org.openjena.riot.tokens.Token

       
        private void directives()
        {
            while ( lookingAt(TokenType.KEYWORD) )
            {
                Token t = nextToken() ;
                if ( t.getImage().equalsIgnoreCase("VARS") )
                {
                    directiveVars() ;
                    continue ;
                }
                if ( t.getImage().equalsIgnoreCase("PREFIX") )
                {
                    directivePrefix() ;
                    continue ;
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.