rvl.swv
Class LaTeXSyntax

java.lang.Object
  extended by rvl.swv.LaTeXSyntax
All Implemented Interfaces:
SyntaxInterface

public class LaTeXSyntax
extends java.lang.Object
implements SyntaxInterface

Implements LaTeX-style syntax for LaTeXFile. In this syntax, code chunks are enclosed in an environment named langcode, expressions are of the form \langexpr{expr}, and language-specific options are of the form \langweaveOpts{opts}


Constructor Summary
LaTeXSyntax()
          Default constructor.
LaTeXSyntax(FileInterface fi)
          Alternative constructor
 
Method Summary
 java.util.Vector<java.lang.String> getArgs()
          Return the vector of arguments in latest code reference
 java.lang.String getDetails()
          Return details of last result of testInline().
 java.lang.String getLastMatch()
          Return exact string that was matched by most recent tag search
 java.lang.String getOptionList()
          Return the option list for the code chunk just detected.
 boolean isChunkEnd(java.lang.String line)
          Return whether or not the current line ends a code chunk
 void setFileInterface(FileInterface filei)
          Set the FileInterface associated with this instance.
 java.lang.String testChunk(java.lang.String line)
          Test a line of the source file.
 java.lang.String testCoderef(java.lang.String line)
          Test a line of code.
 Tag testInline(java.lang.String line)
          Test the line for an occurrence of an expression or a recall, and return the appropriate tag.
 java.lang.String testOpts(java.lang.String line)
          Test a source line to see if it is a global or language-specific option specification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LaTeXSyntax

public LaTeXSyntax()
Default constructor. Need to call setFileInterface before we can use it


LaTeXSyntax

public LaTeXSyntax(FileInterface fi)
Alternative constructor

Method Detail

setFileInterface

public void setFileInterface(FileInterface filei)
Set the FileInterface associated with this instance. Implementors probably also may want to get parent info from it

Specified by:
setFileInterface in interface SyntaxInterface

testChunk

public java.lang.String testChunk(java.lang.String line)
Test a line of the source file. If it starts a code chunk, return its language. Otherwise, return null

Specified by:
testChunk in interface SyntaxInterface

getOptionList

public java.lang.String getOptionList()
Return the option list for the code chunk just detected. This is required to be a comma-delimited list

Specified by:
getOptionList in interface SyntaxInterface

isChunkEnd

public boolean isChunkEnd(java.lang.String line)
Return whether or not the current line ends a code chunk

Specified by:
isChunkEnd in interface SyntaxInterface

testOpts

public java.lang.String testOpts(java.lang.String line)
Test a source line to see if it is a global or language-specific option specification. Return null if not, the name of the language if it is language-specific, or an empty string if it is global. The options themselves are retrieved using getOptionList().

Specified by:
testOpts in interface SyntaxInterface

testCoderef

public java.lang.String testCoderef(java.lang.String line)
Test a line of code. If it is a code reference, return its label, else null. If non-null, any arguments supplied are available via getArgs()

Specified by:
testCoderef in interface SyntaxInterface

getArgs

public java.util.Vector<java.lang.String> getArgs()
Return the vector of arguments in latest code reference

Specified by:
getArgs in interface SyntaxInterface

testInline

public Tag testInline(java.lang.String line)
Test the line for an occurrence of an expression or a recall, and return the appropriate tag. The line argument matters only on the first call for this line. Subsequent calls find subsequent matches. A null is return when there are no more

Specified by:
testInline in interface SyntaxInterface

getDetails

public java.lang.String getDetails()
Return details of last result of testInline(). If it is an expression, it is "lang expr", otherwise for a recall, it is the label being recalled.

Specified by:
getDetails in interface SyntaxInterface

getLastMatch

public java.lang.String getLastMatch()
Return exact string that was matched by most recent tag search

Specified by:
getLastMatch in interface SyntaxInterface