Package jade.content.lang.sl
Class SimpleSLTokenizer
- java.lang.Object
-
- jade.content.lang.sl.SimpleSLTokenizer
-
public class SimpleSLTokenizer extends Object
Simple utility class for hand-made SL parsing- Author:
- Giovanni Caire - TILAB
-
-
Constructor Summary
Constructors Constructor Description SimpleSLTokenizer(String s)Construct a SimpleSLTokenizer that will act on the given String
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconsumeChar(char c)Check that the next character (after eventual spaces) is 'c' and advance the pointer to the character just afterStringgetElement()Return the next SL element (i.e.static booleanisAWord(String s)Test if the given string is a legal SL word using the FIPA XC00008D spec.booleanisClosedBracket()booleanisOpenBracket()StringnextToken()Return the next SL token (i.e.static StringquoteString(String s)Take a java String and quote it to form a legal FIPA SL0 string.
-
-
-
Constructor Detail
-
SimpleSLTokenizer
public SimpleSLTokenizer(String s)
Construct a SimpleSLTokenizer that will act on the given String
-
-
Method Detail
-
nextToken
public String nextToken() throws Codec.CodecException
Return the next SL token (i.e. '(', ')' or a generic element) without advancing the pointer- Throws:
Codec.CodecException
-
isOpenBracket
public boolean isOpenBracket() throws Codec.CodecException- Throws:
Codec.CodecException
-
isClosedBracket
public boolean isClosedBracket() throws Codec.CodecException- Throws:
Codec.CodecException
-
consumeChar
public void consumeChar(char c) throws Codec.CodecExceptionCheck that the next character (after eventual spaces) is 'c' and advance the pointer to the character just after- Throws:
Codec.CodecException
-
getElement
public String getElement() throws Codec.CodecException
Return the next SL element (i.e. a word or a generic sequence of char enclosed into "") and advance the pointer to the character just after. If the element starts with ':' this is automatically removed. If the element is a sequence of char enclosed into "" the enclosing " are removed and all \" are automatically transformed into "- Throws:
Codec.CodecException
-
isAWord
public static final boolean isAWord(String s)
Test if the given string is a legal SL word using the FIPA XC00008D spec. In addition to FIPA's restrictions, place the additional restriction that a Word can not contain a '\"', that would confuse the parser at the other end.
-
-