org.pz.platypus.parsers
Class CommandStartParser

java.lang.Object
  extended by org.pz.platypus.parsers.CommandStartParser

public class CommandStartParser
extends java.lang.Object

Determines whether a sequence containing a [ is the beginning of a command. This is a pure lexical analysis. This parser has no awareness of any state, such as in-comment, in-code, or any such thing. Note: sole method is static

Author:
alb

Constructor Summary
CommandStartParser()
           
 
Method Summary
static boolean isItACommand(char[] content, int parsePoint)
          Static method that determines lexically whether a sequence of characters containing an embedded [ is a command.
static boolean isItEscapedCommandStart(char[] content, int parsePoint)
          If the [ command is preceded by a /, then it's not a command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandStartParser

public CommandStartParser()
Method Detail

isItACommand

public static boolean isItACommand(char[] content,
                                   int parsePoint)
Static method that determines lexically whether a sequence of characters containing an embedded [ is a command. It's a command if: 1) the [ is not preceded by a / 2) the [ is not followed by a whitespace or control character 3) the [ is not followed by a digit Anything else, returns true. It might subsequently turn out that the chars are in fact not a valid command, but this will be treated as an error by the parser and then passed through to the final document as text.

Parameters:
content - char array containing text to analyze
parsePoint - where we begin the analysis
Returns:
true if a command; false, if not

isItEscapedCommandStart

public static boolean isItEscapedCommandStart(char[] content,
                                              int parsePoint)
If the [ command is preceded by a /, then it's not a command. This routine determines whether that sequence of chars exists

Parameters:
content - the text being examined
parsePoint - the point at which the [ occurs
Returns:
true if it is escaped, false if not


Copyright © 2008-10 Pacific Data Works LLC