Java Doc for ExpressionParser.java in  » XML » saxonb » net » sf » saxon » expr » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » XML » saxonb » net.sf.saxon.expr 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.sf.saxon.expr.ExpressionParser

All known Subclasses:   net.sf.saxon.query.QueryParser,
ExpressionParser
public class ExpressionParser (Code)
Parser for XPath expressions and XSLT patterns. This code was originally inspired by James Clark's xt but has been totally rewritten (several times)
author:
   Michael Kay

Inner Class :public static class ForClause
Inner Class :protected static class TemporaryContainer implements Container,LocationProvider,Serializable

Field Summary
final protected static  intSEQUENCE_TYPE
    
final protected static  intXPATH
    
final protected static  intXQUERY
    
final protected static  intXSLT_PATTERN
    
protected  StaticContextenv
    
protected  intlanguage
    
protected  NameCheckernameChecker
    
protected  StackrangeVariables
    
protected  booleanscanOnly
    
protected  Tokenizert
    

Constructor Summary
public  ExpressionParser()
    

Method Summary
protected  StringcurrentTokenDisplay()
    
protected  voiddeclareRangeVariable(VariableDeclaration declaration)
     Declare a range variable (record its existence within the parser).
protected  voidexpect(int token)
     Expect a given token; fail if the current token is different.
protected  StringgetLanguage()
    
public  StackgetRangeVariableStack()
     Get the range variable stack.
public  TokenizergetTokenizer()
    
protected  voidgrumble(String message)
    
protected  voidgrumble(String message, String errorCode)
    
protected  booleanisKeyword(String s)
     Test whether the current token is a given keyword.
public  LocalNameTestmakeLocalNameTest(short nodeType, String localName)
    
final public  intmakeNameCode(String qname, boolean useDefault)
     Make a NameCode, using this Element as the context for namespace resolution
throws:
  net.sf.saxon.trans.StaticError - if the name is invalid, or the prefixundeclared
Parameters:
  qname - The name as written, in the form "[prefix:]localname"
Parameters:
  useDefault - Defines the action when there is no prefix.
public  NameTestmakeNameTest(short nodeType, String qname, boolean useDefault)
    
public  NamespaceTestmakeNamespaceTest(short nodeType, String prefix)
    
protected  StringValuemakeStringLiteral(String currentTokenValue)
     Method to make a string literal from a token identified as a string literal.
protected  ExpressionmakeTracer(int startOffset, Expression exp, int construct, int objectNameCode)
    
protected  voidnextToken()
    
public  Expressionparse(String expression, int start, int terminator, int lineNumber, StaticContext env)
    
protected  ExpressionparseConstructor()
     Parse a node constructor.
protected  ExpressionparseExprSingle()
    
protected  ExpressionparseExpression()
    
protected  ExpressionparseExtensionExpression()
    
protected  ExpressionparseForExpression()
    
protected  ExpressionparseMappingExpression()
     Parse a mapping expression.
protected  NodeTestparseNodeTest(short nodeType)
     Parse a NodeTest.
public  PatternparsePattern(String pattern, StaticContext env)
    
protected  ExpressionparseRelativePath()
     Parse a relative path (a sequence of steps).
protected  ExpressionparseRemainingPath(Expression start)
     Parse the remaining steps of an absolute path expression (one starting in "/" or "//").
public  SequenceTypeparseSequenceType(String input, StaticContext env)
    
protected  SequenceTypeparseSequenceType()
     Parse the sequence type production.
protected  ExpressionparseStepExpression()
    
protected  ExpressionparseTypeswitchExpression()
     Parse a Typeswitch Expression.
protected  ExpressionparseValidateExpression()
     Parse a Validate Expression.
protected  voidsetLocation(Expression exp)
     Set location information on an expression.
protected  voidsetLocation(Expression exp, int offset)
     Set location information on an expression.
public  voidsetRangeVariableStack(Stack stack)
     Set the range variable stack.
public  voidsetScanOnly(boolean scanOnly)
    
protected  voidundeclareRangeVariable()
    
protected  voidwarning(String message)
    

Field Detail
SEQUENCE_TYPE
final protected static int SEQUENCE_TYPE(Code)



XPATH
final protected static int XPATH(Code)



XQUERY
final protected static int XQUERY(Code)



XSLT_PATTERN
final protected static int XSLT_PATTERN(Code)



env
protected StaticContext env(Code)



language
protected int language(Code)



nameChecker
protected NameChecker nameChecker(Code)



rangeVariables
protected Stack rangeVariables(Code)



scanOnly
protected boolean scanOnly(Code)



t
protected Tokenizer t(Code)




Constructor Detail
ExpressionParser
public ExpressionParser()(Code)




Method Detail
currentTokenDisplay
protected String currentTokenDisplay()(Code)
Display the current token in an error message the display representation of the token



declareRangeVariable
protected void declareRangeVariable(VariableDeclaration declaration) throws StaticError(Code)
Declare a range variable (record its existence within the parser). A range variable is a variable declared within an expression, as distinct from a variable declared in the context.
Parameters:
  declaration - the VariableDeclaration to be added to the stack
throws:
  net.sf.saxon.trans.StaticError - if any error is encountered



expect
protected void expect(int token) throws StaticError(Code)
Expect a given token; fail if the current token is different. Note that this method does not read any tokens.
Parameters:
  token - the expected token
throws:
  net.sf.saxon.trans.StaticError - if the current token is not the expectedtoken



getLanguage
protected String getLanguage()(Code)
Get the current language (XPath or XQuery)



getRangeVariableStack
public Stack getRangeVariableStack()(Code)
Get the range variable stack. Used when parsing a nested subexpression inside an attribute constructor



getTokenizer
public Tokenizer getTokenizer()(Code)



grumble
protected void grumble(String message) throws StaticError(Code)
Report a syntax error (a static error with error code XP0003)
Parameters:
  message - the error message
exception:
  net.sf.saxon.trans.StaticError - always thrown: an exception containing thesupplied message



grumble
protected void grumble(String message, String errorCode) throws StaticError(Code)
Report a static error
Parameters:
  message - the error message
Parameters:
  errorCode - the error code
throws:
  net.sf.saxon.trans.StaticError - always thrown: an exception containing thesupplied message



isKeyword
protected boolean isKeyword(String s)(Code)
Test whether the current token is a given keyword.
Parameters:
  s - The string to be compared with the current token true if they are the same



makeLocalNameTest
public LocalNameTest makeLocalNameTest(short nodeType, String localName) throws StaticError(Code)
Make a LocalNameTest (*:name)
Parameters:
  nodeType - the kind of node to be matched
Parameters:
  localName - the requred local name
throws:
  net.sf.saxon.trans.StaticError - if the local name is invalid a LocalNameTest, a pattern which matches all nodes of a givenlocal name, regardless of namespace



makeNameCode
final public int makeNameCode(String qname, boolean useDefault) throws StaticError(Code)
Make a NameCode, using this Element as the context for namespace resolution
throws:
  net.sf.saxon.trans.StaticError - if the name is invalid, or the prefixundeclared
Parameters:
  qname - The name as written, in the form "[prefix:]localname"
Parameters:
  useDefault - Defines the action when there is no prefix. Iftrue, use the default namespace URI for element names. If false,use no namespace URI (as for attribute names). the namecode, which can be used to identify this name in thename pool



makeNameTest
public NameTest makeNameTest(short nodeType, String qname, boolean useDefault) throws StaticError(Code)
Make a NameTest, using the static context for namespace resolution
Parameters:
  nodeType - the type of node required (identified by a constant inclass Type)
Parameters:
  qname - the lexical QName of the required node
Parameters:
  useDefault - true if the default namespace should be used whenthe QName is unprefixed
throws:
  net.sf.saxon.trans.StaticError - if the QName is invalid a NameTest, representing a pattern that tests for a node of agiven node kind and a given name



makeNamespaceTest
public NamespaceTest makeNamespaceTest(short nodeType, String prefix) throws StaticError(Code)
Make a NamespaceTest (name:*)
Parameters:
  nodeType - integer code identifying the type of node required
Parameters:
  prefix - the namespace prefix
throws:
  net.sf.saxon.trans.StaticError - if the namespace prefix is not declared the NamespaceTest, a pattern that matches all nodes in thisnamespace



makeStringLiteral
protected StringValue makeStringLiteral(String currentTokenValue) throws StaticError(Code)
Method to make a string literal from a token identified as a string literal. This is trivial in XPath, but in XQuery the method is overridden to identify pseudo-XML character and entity references. Note that the job of handling doubled string delimiters is done by the tokenizer.
Parameters:
  currentTokenValue - The string value of the string literal



makeTracer
protected Expression makeTracer(int startOffset, Expression exp, int construct, int objectNameCode)(Code)
If tracing, wrap an instruction in a trace instruction



nextToken
protected void nextToken() throws StaticError(Code)
Read the next token, catching any exception thrown by the tokenizer



parse
public Expression parse(String expression, int start, int terminator, int lineNumber, StaticContext env) throws StaticError(Code)
Parse a string representing an expression
throws:
  net.sf.saxon.trans.StaticError - if the expression contains a syntax error
Parameters:
  expression - the expression expressed as a String
Parameters:
  start - offset within the string where parsing is to start
Parameters:
  terminator - character to treat as terminating the expression
Parameters:
  lineNumber - location of the start of the expression, for diagnostics
Parameters:
  env - the static context for the expression an Expression object representing the result of parsing



parseConstructor
protected Expression parseConstructor() throws StaticError(Code)
Parse a node constructor. This is allowed only in XQuery, so the method throws an error for XPath.



parseExprSingle
protected Expression parseExprSingle() throws StaticError(Code)
Parse an ExprSingle
throws:
  net.sf.saxon.trans.StaticError - if any error is encountered the resulting subexpression



parseExpression
protected Expression parseExpression() throws StaticError(Code)
Parse a top-level Expression: ExprSingle ( ',' ExprSingle )*
throws:
  net.sf.saxon.trans.StaticError - if the expression contains a syntax error the Expression object that results from parsing



parseExtensionExpression
protected Expression parseExtensionExpression() throws StaticError(Code)
Parse an Extension Expression This construct is XQuery-only, so the XPath version of this method throws an error unconditionally



parseForExpression
protected Expression parseForExpression() throws StaticError(Code)
Parse a FOR expression: for $x in expr (',' $y in expr)* 'return' expr
throws:
  net.sf.saxon.trans.StaticError - if any error is encountered the resulting subexpression



parseMappingExpression
protected Expression parseMappingExpression() throws StaticError(Code)
Parse a mapping expression. This is a common routine that handles XPath for expressions and quantified expressions.

Syntax:
(for|some|every) $x in expr (',' $y in expr)* (return|satisfies) expr

On entry, the current token indicates whether a for, some, or every expression is expected.


throws:
  net.sf.saxon.trans.StaticError - if any error is encountered the resulting subexpression



parseNodeTest
protected NodeTest parseNodeTest(short nodeType) throws StaticError(Code)
Parse a NodeTest. One of QName, prefix:*, *:suffix, *, text(), node(), comment(), or processing-instruction(literal?), or element(~,~), attribute(~,~), etc.
throws:
  net.sf.saxon.trans.StaticError - if any error is encountered
Parameters:
  nodeType - the node type being sought if one is specified the resulting NodeTest object



parsePattern
public Pattern parsePattern(String pattern, StaticContext env) throws StaticError(Code)
Parse a string representing an XSLT pattern
throws:
  net.sf.saxon.trans.StaticError - if the pattern contains a syntax error
Parameters:
  pattern - the pattern expressed as a String
Parameters:
  env - the static context for the pattern a Pattern object representing the result of parsing



parseRelativePath
protected Expression parseRelativePath() throws StaticError(Code)
Parse a relative path (a sequence of steps). Called when the current token immediately follows a separator (/ or //), or an implicit separator (XYZ is equivalent to ./XYZ)
throws:
  net.sf.saxon.trans.StaticError - if any error is encountered the resulting subexpression



parseRemainingPath
protected Expression parseRemainingPath(Expression start) throws StaticError(Code)
Parse the remaining steps of an absolute path expression (one starting in "/" or "//"). Note that the token immediately after the "/" or "//" has already been read, and in the case of "/", it has been confirmed that we have a path expression starting with "/" rather than a standalone "/" expression.
Parameters:
  start - the initial implicit expression: root() in the case of "/", root()/descendant-or-self::node inthe case of "//" the completed path expression
throws:
  StaticError -



parseSequenceType
public SequenceType parseSequenceType(String input, StaticContext env) throws StaticError(Code)
Parse a string representing a sequence type
Parameters:
  input - the string, which should conform to the XPath SequenceTypeproduction
Parameters:
  env - the static context
throws:
  net.sf.saxon.trans.StaticError - if any error is encountered a SequenceType object representing the type



parseSequenceType
protected SequenceType parseSequenceType() throws StaticError(Code)
Parse the sequence type production. Provisionally, we use the syntax (QName | node-kind "()") ( "*" | "+" | "?" )? We also allow "element of type QName" and "attribute of type QName" The QName must be the name of a built-in schema-defined data type.
throws:
  net.sf.saxon.trans.StaticError - if any error is encountered the resulting subexpression



parseStepExpression
protected Expression parseStepExpression() throws StaticError(Code)
Parse a step (including an optional sequence of predicates)
throws:
  net.sf.saxon.trans.StaticError - if any error is encountered the resulting subexpression



parseTypeswitchExpression
protected Expression parseTypeswitchExpression() throws StaticError(Code)
Parse a Typeswitch Expression. This construct is XQuery-only, so the XPath version of this method throws an error unconditionally



parseValidateExpression
protected Expression parseValidateExpression() throws StaticError(Code)
Parse a Validate Expression. This construct is XQuery-only, so the XPath version of this method throws an error unconditionally



setLocation
protected void setLocation(Expression exp)(Code)
Set location information on an expression. At present this consists of a simple line number. Needed mainly for XQuery.



setLocation
protected void setLocation(Expression exp, int offset)(Code)
Set location information on an expression. At present only the line number is retained. Needed mainly for XQuery. This version of the method supplies an explicit offset (character position within the expression or query), which the tokenizer can convert to a line number and column number.



setRangeVariableStack
public void setRangeVariableStack(Stack stack)(Code)
Set the range variable stack. Used when parsing a nested subexpression inside an attribute constructor.



setScanOnly
public void setScanOnly(boolean scanOnly)(Code)



undeclareRangeVariable
protected void undeclareRangeVariable()(Code)
Note when the most recently declared range variable has gone out of scope



warning
protected void warning(String message) throws StaticError(Code)
Output a warning message



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.