org.apache.felix.gogo.runtime
Class Tokenizer

java.lang.Object
  extended by org.apache.felix.gogo.runtime.Tokenizer

public class Tokenizer
extends Object

Bash-like tokenizer. Single and double quotes are just like Bash - single quotes escape everything (including backslashes), newlines are allowed in quotes. backslash-newline indicates a line continuation and is removed. Variable expansion is just like Bash: $NAME or ${NAME[[:][-+=?WORD]}, except it can yield any Object. Variables expanded within double-quotes, or adjacent to a String are converted to String. Unlike bash, indirect variable expansion is supported using ${$NAME}. Only a single variable assignment is recognized, with '=' being the second token. (Bash allows name1=value1 name2=value2 ... command args) Comments can only start where white space is allowed: # or // starts a line comment, /* starts a block comment. The following common uses do NOT start comments: ls http://example.com#anchor ls $dir/*.java

See Also:
http://wiki.bash-hackers.org/syntax/basicgrammar

Nested Class Summary
static class Tokenizer.Type
           
 
Constructor Summary
Tokenizer(CharSequence text)
           
Tokenizer(CharSequence text, Evaluate evaluate, boolean inQuote)
           
 
Method Summary
static Object expand(CharSequence word, Evaluate eval)
          expand variables, quotes and escapes in word.
 Object expand(CharSequence word, short line, short column)
           
 Tokenizer.Type next()
           
 Token token()
           
 Tokenizer.Type type()
           
 CharSequence value()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tokenizer

public Tokenizer(CharSequence text)

Tokenizer

public Tokenizer(CharSequence text,
                 Evaluate evaluate,
                 boolean inQuote)
Method Detail

type

public Tokenizer.Type type()

value

public CharSequence value()

token

public Token token()

next

public Tokenizer.Type next()

expand

public static Object expand(CharSequence word,
                            Evaluate eval)
                     throws Exception
expand variables, quotes and escapes in word.

Parameters:
vars -
Returns:
Throws:
Exception

expand

public Object expand(CharSequence word,
                     short line,
                     short column)
              throws Exception
Throws:
Exception


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.