verinec.importer.parser.iptables.parser
Class Lexer

java.lang.Object
  extended by verinec.importer.parser.iptables.parser.Lexer

public class Lexer
extends Object

Lexer for a iptables -vnL command output. This class makes the lecical analysis, devides the String into tokens and creates the list of tokens.

Author:
geraldine.antener at unifr.ch

Nested Class Summary
 class Lexer.CountingTokenizer
          This tokenizer keeps track of the position of the words.
 
Field Summary
private static String EOF
          End of file identifier.
private  int lineCounter
          Current line in the input data.
private  int pos
          Current reading position within the line.
private  Lexer.CountingTokenizer reader
          The content to analyse.
 Vector tokens
          The list of tokens
private  String word
          Current word.
 
Constructor Summary
Lexer(String content)
          Create a new lexer and analyser the content.
 
Method Summary
private  void addList(String word, String type)
          Add the word and its type to the list of tokens.
private  void analyse()
           
private  String typeLastToken()
          Get the type of the last token in the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EOF

private static String EOF
End of file identifier.


tokens

public Vector tokens
The list of tokens


reader

private Lexer.CountingTokenizer reader
The content to analyse.


word

private String word
Current word.


lineCounter

private int lineCounter
Current line in the input data.


pos

private int pos
Current reading position within the line. Denotes the end of the last word token.

Constructor Detail

Lexer

public Lexer(String content)
Create a new lexer and analyser the content.

Parameters:
content - The document to analyser.
Method Detail

analyse

private void analyse()

addList

private void addList(String word,
                     String type)
Add the word and its type to the list of tokens.

Parameters:
word - The text from the tokenizer.
type - The type identifier.

typeLastToken

private String typeLastToken()
Get the type of the last token in the list.

Returns:
Type name of the last token in the list.

Copyright © 2005 Verinec, DIUF