asia.redact.bracket.properties
Class PropertiesLexer

java.lang.Object
  extended by asia.redact.bracket.properties.PropertiesLexer

public class PropertiesLexer
extends Object

 Parse a properties file conforming to the description at
  http://download.oracle.com/javase/6/docs/api/java/util/Properties.html#load(java.io.Reader)
  into tokens.
 
 There is one additional extension: a comment line which starts with #;; is treated 
 as transient (not read in). This is used later to generate a transient header and footer
 
 This is an "off-line" lexer, it is backed by a String as input, which implies it is memory
 fed. That's not a problem for all but the biggest properties files on contemporary hardware.
 
 

Author:
Dave
See Also:
PropertiesToken, PropertiesTokenType, InputAdapter

Field Summary
(package private)  int index
           
(package private)  String input
           
(package private)  List<PropertiesToken> list
           
private  Lock lock
           
 
Constructor Summary
PropertiesLexer(File in)
          Convenience method, swallows the input whole
PropertiesLexer(InputStream in)
          Convenience method, swallows the input whole
PropertiesLexer(Reader in)
          Convenience method, swallows the input whole
PropertiesLexer(String input)
           
 
Method Summary
private  void analyzeLine(String buf, PropertiesToken tok)
           
private  void comment(String buf)
           
 List<PropertiesToken> getList()
           
private  boolean hasNext()
           
private  Character la(int count)
           
 void lex()
           
private  char next()
           
private  void scanKeyValue(String buf, PropertiesToken eol)
           
private  PropertiesToken scanLineBreak()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

input

final String input

index

int index

list

final List<PropertiesToken> list

lock

private final Lock lock
Constructor Detail

PropertiesLexer

public PropertiesLexer(String input)

PropertiesLexer

public PropertiesLexer(Reader in)
Convenience method, swallows the input whole

Parameters:
in -

PropertiesLexer

public PropertiesLexer(File in)
Convenience method, swallows the input whole

Parameters:
in -

PropertiesLexer

public PropertiesLexer(InputStream in)
Convenience method, swallows the input whole

Parameters:
in -
Method Detail

lex

public void lex()

analyzeLine

private void analyzeLine(String buf,
                         PropertiesToken tok)

scanKeyValue

private void scanKeyValue(String buf,
                          PropertiesToken eol)

comment

private void comment(String buf)

scanLineBreak

private PropertiesToken scanLineBreak()

hasNext

private boolean hasNext()

next

private char next()

la

private Character la(int count)

getList

public List<PropertiesToken> getList()


Copyright © 2011-2013 David R. Smith. All Rights Reserved.