Java Doc for StandardLexerRules.java in  » Parser » runcc » fri » patterns » interpreter » parsergenerator » lexer » 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 » Parser » runcc » fri.patterns.interpreter.parsergenerator.lexer 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   fri.patterns.interpreter.parsergenerator.lexer.StandardLexerRules

StandardLexerRules
abstract public class StandardLexerRules (Code)
Standard lexer rules are building blocks for lexers dealing with text input. This class resolves nonterminals enclosed in `backquotes` within an EBNF, e.g. `cstylecomment`.

Furthermore it provides methods to retrieve sets of rules describing certain standard scan items like `number` or `identifier`. The resulting arrays can be built together by SyntaxUtil.catenizeRules(...).

This class provides rules for comments with an arbitrary start character or start/end sequence:

  • getCustomOneLineCommentRules(String startChar)
  • and
  • getCustomMultiLineCommentRules(String startSeq, String endSeq)
  • .

Example (CStyleCommentStrip):

 String [][] rules = {
 { Token.TOKEN, "others" },	// define what we want to receive
 { Token.TOKEN, "`stringdef`" },	// need this rule as string definitions could contain comments
 { Token.IGNORED, "`cstylecomment`" },
 { "others", "others", "other" },
 { "others", "other" },
 { "other", "`char`", Token.BUTNOT, "`cstylecomment`", Token.BUTNOT, "`stringdef`" },
 };
 Syntax syntax = new Syntax(rules);
 SyntaxSeparation separation = new SyntaxSeparation(syntax);
 LexerBuilder builder = new LexerBuilder(separation.getLexerSyntax(), separation.getIgnoredSymbols());
 Lexer lexer = builder.getLexer();
 
TODO: Refactor this class and make smaller units with better names.
See Also:   fri.patterns.interpreter.parsergenerator.lexer.LexerBuilder
author:
   (c) 2002, Fritz Ritzberger


Field Summary
final public static  String[][]chardefRules
     Rules describing C/Java-like character definitions: 'c', '\r', '\007'.
final public static  String[][]digitRules
     Numerical rules for binary and octal digits.
final public static  String[][]lexerSyntax
     Premade lexer syntax used to scan textual EBNF-like syntax specifications.
final public static  String[][]newlinesRules
     Rules describing one or more newlines.
final public static  String[][]numberRules
     Numerical rules for numbers within sourcecode: number ::= integer | float.
final public static  String[][]whitespaceRules
     Rules describing whitespace: newlines and spaces, minimum one.
final public static  String[][]xmlCharRules
     XML Char definitions of W3C.
final public static  String[][]xmlCombinigAndExtenderRules
     XML CombiningChar and XML Extender definitions of W3C.


Method Summary
final public static  String[][]catenizeRules(String[][][] arrays)
     Catenizes some rule sets to one rule set.
final public static  String[][]getBinDigitsRules()
     Rules for binary number chars.
final public static  String[][]getCStyleCommentRules()
     Rules to scan C-style slash-star and slash-slash comments.
final public static  String[][]getCommentRules()
     Rules to scan C-style slash-star and slash-slash AND shell-style # comments.
final public static  String[][]getCustomMultiLineCommentRules(String nonterminalName, String startSeq, String endSeq)
     Returns rules for a custom comment (like C-style "/*", but with passed start and end sequence).
Parameters:
  nonterminalName - name of comment to be used within syntax, e.g.
final public static  String[][]getCustomOneLineCommentRules(String nonterminalName, String startChar)
     Returns rules for a custom comment (like C-style "//", but with passed start sequence).
Parameters:
  nonterminalName - name of comment to be used within syntax, e.g.
final public static  String[][]getFloatRules()
     Rules for float number chars.
final public static  String[][]getHexDigitRules()
     Rules to scan one hexdigit.
final public static  String[][]getHexDigitsRules()
     Rules to scan hexdigits that form a number, starting "0x" not included.
final public static  String[][]getIntegerRules()
     Rules for integer number chars.
final public static  String[][]getNewlineRules()
     Rules to scan one platform independent newline.
final public static  String[][]getNewlinesRules()
     Rules to scan one platform independent newline.
final public static  String[][]getNumberRules()
     Rules for general number chars (integer, float).
final public static  String[][]getOctDigitsRules()
     Rules for octal number chars.
final public static  String[][]getQuantifierRules()
     Rules to read quantifiers "*+?" within EBNF syntax specifications.
final public static  String[][]getRulerefRules()
     Rules to read a `lexerrule` within EBNF syntax specifications.
final public static  String[][]getShellStyleCommentRules()
     Rules to scan # shell-style comments.
final public static  String[][]getSpaceRules()
     Rules to scan one space.
final public static  String[][]getSpacesRules()
     Rules to scan spaces.
final public static  String[][]getUnicodeBNFChardefRules()
     Rules to scan BNF-like 'c'haracterdefinitions.
final public static  String[][]getUnicodeCharRules()
     Rules to scan one UNICODE character: 0x0 ..
final public static  String[][]getUnicodeChardefRules()
     Rules to scan C/Java-like 'c'haracterdefinitions: '\377', 'A', '\n'.
final public static  String[][]getUnicodeCombiningCharRules()
     Rules for XML combining chars.
final public static  String[][]getUnicodeDigitRules()
     Rules to scan one digit.
final public static  String[][]getUnicodeDigitsRules()
     Rules to scan digits.
final public static  String[][]getUnicodeExtenderCharRules()
     Rules for XML extender chars.
final public static  String[][]getUnicodeIdentifierRules()
     Rules to scan identifiers that start with letter and continue with letter or digit or '_'.
final public static  String[][]getUnicodeLetterRules()
     Rules to scan one letter.
final public static  String[][]getUnicodeStringdefRules()
     Rules to scan "stringdefinitions" that can contain backslash as masking character.
final public static  String[][]getUnicodeXmlCharRules()
     Rules for XML combining chars.
final public static  String[][]getWhitespaceRules()
     Rules to scan one space or newline.
final public static  String[][]getWhitespacesRules()
     Rules to scan spaces or newlines.
public static  voidprintRules(String[][] syntax)
     Print a grammar to System.out.
public static  String[][]rulesForIdentifier(String id)
     Returns e.g.

Field Detail
chardefRules
final public static String[][] chardefRules(Code)
Rules describing C/Java-like character definitions: 'c', '\r', '\007'.



digitRules
final public static String[][] digitRules(Code)
Numerical rules for binary and octal digits.



lexerSyntax
final public static String[][] lexerSyntax(Code)
Premade lexer syntax used to scan textual EBNF-like syntax specifications.



newlinesRules
final public static String[][] newlinesRules(Code)
Rules describing one or more newlines.



numberRules
final public static String[][] numberRules(Code)
Numerical rules for numbers within sourcecode: number ::= integer | float.



whitespaceRules
final public static String[][] whitespaceRules(Code)
Rules describing whitespace: newlines and spaces, minimum one.



xmlCharRules
final public static String[][] xmlCharRules(Code)
XML Char definitions of W3C.



xmlCombinigAndExtenderRules
final public static String[][] xmlCombinigAndExtenderRules(Code)
XML CombiningChar and XML Extender definitions of W3C.





Method Detail
catenizeRules
final public static String[][] catenizeRules(String[][][] arrays)(Code)
Catenizes some rule sets to one rule set. Does not check for uniqueness.



getBinDigitsRules
final public static String[][] getBinDigitsRules()(Code)
Rules for binary number chars.



getCStyleCommentRules
final public static String[][] getCStyleCommentRules()(Code)
Rules to scan C-style slash-star and slash-slash comments.



getCommentRules
final public static String[][] getCommentRules()(Code)
Rules to scan C-style slash-star and slash-slash AND shell-style # comments.



getCustomMultiLineCommentRules
final public static String[][] getCustomMultiLineCommentRules(String nonterminalName, String startSeq, String endSeq)(Code)
Returns rules for a custom comment (like C-style "/*", but with passed start and end sequence).
Parameters:
  nonterminalName - name of comment to be used within syntax, e.g. "pascalComment".
Parameters:
  startSeq - string defining the start sequence of the comment, e.g. "(*"
Parameters:
  endSeq - string defining the end sequence of the comment, e.g. "*)"



getCustomOneLineCommentRules
final public static String[][] getCustomOneLineCommentRules(String nonterminalName, String startChar)(Code)
Returns rules for a custom comment (like C-style "//", but with passed start sequence).
Parameters:
  nonterminalName - name of comment to be used within syntax, e.g. "basicComment".
Parameters:
  startChar - string (1-n characters) defining the start sequence of the comment, e.g. ";"



getFloatRules
final public static String[][] getFloatRules()(Code)
Rules for float number chars.



getHexDigitRules
final public static String[][] getHexDigitRules()(Code)
Rules to scan one hexdigit.



getHexDigitsRules
final public static String[][] getHexDigitsRules()(Code)
Rules to scan hexdigits that form a number, starting "0x" not included.



getIntegerRules
final public static String[][] getIntegerRules()(Code)
Rules for integer number chars.



getNewlineRules
final public static String[][] getNewlineRules()(Code)
Rules to scan one platform independent newline.



getNewlinesRules
final public static String[][] getNewlinesRules()(Code)
Rules to scan one platform independent newline.



getNumberRules
final public static String[][] getNumberRules()(Code)
Rules for general number chars (integer, float).



getOctDigitsRules
final public static String[][] getOctDigitsRules()(Code)
Rules for octal number chars.



getQuantifierRules
final public static String[][] getQuantifierRules()(Code)
Rules to read quantifiers "*+?" within EBNF syntax specifications.



getRulerefRules
final public static String[][] getRulerefRules()(Code)
Rules to read a `lexerrule` within EBNF syntax specifications.



getShellStyleCommentRules
final public static String[][] getShellStyleCommentRules()(Code)
Rules to scan # shell-style comments.



getSpaceRules
final public static String[][] getSpaceRules()(Code)
Rules to scan one space.



getSpacesRules
final public static String[][] getSpacesRules()(Code)
Rules to scan spaces.



getUnicodeBNFChardefRules
final public static String[][] getUnicodeBNFChardefRules()(Code)
Rules to scan BNF-like 'c'haracterdefinitions. They differ from C/Java-chardefs in that they can be written as digits: 0x20.



getUnicodeCharRules
final public static String[][] getUnicodeCharRules()(Code)
Rules to scan one UNICODE character: 0x0 .. 0xFFFF.



getUnicodeChardefRules
final public static String[][] getUnicodeChardefRules()(Code)
Rules to scan C/Java-like 'c'haracterdefinitions: '\377', 'A', '\n'.



getUnicodeCombiningCharRules
final public static String[][] getUnicodeCombiningCharRules()(Code)
Rules for XML combining chars.



getUnicodeDigitRules
final public static String[][] getUnicodeDigitRules()(Code)
Rules to scan one digit.



getUnicodeDigitsRules
final public static String[][] getUnicodeDigitsRules()(Code)
Rules to scan digits.



getUnicodeExtenderCharRules
final public static String[][] getUnicodeExtenderCharRules()(Code)
Rules for XML extender chars.



getUnicodeIdentifierRules
final public static String[][] getUnicodeIdentifierRules()(Code)
Rules to scan identifiers that start with letter and continue with letter or digit or '_'.



getUnicodeLetterRules
final public static String[][] getUnicodeLetterRules()(Code)
Rules to scan one letter.



getUnicodeStringdefRules
final public static String[][] getUnicodeStringdefRules()(Code)
Rules to scan "stringdefinitions" that can contain backslash as masking character.



getUnicodeXmlCharRules
final public static String[][] getUnicodeXmlCharRules()(Code)
Rules for XML combining chars.



getWhitespaceRules
final public static String[][] getWhitespaceRules()(Code)
Rules to scan one space or newline.



getWhitespacesRules
final public static String[][] getWhitespacesRules()(Code)
Rules to scan spaces or newlines.



printRules
public static void printRules(String[][] syntax)(Code)
Print a grammar to System.out.



rulesForIdentifier
public static String[][] rulesForIdentifier(String id)(Code)
Returns e.g. the Letter-Rules getUnicodeLetterRules() for id "letter". Using this, one can write things like `identifier` in a Lexer specification text, as LexerBuilder tries to resolve these words calling this method. Possible values for id are:
  • char (all UNICODE characters)
  • newline
  • newlines
  • space
  • spaces
  • whitespace
  • whitespaces
  • letter
  • digit
  • digits
  • hexdigit
  • hexdigits (does NOT include preceeding "0x")
  • identifier
  • stringdef
  • chardef
  • bnf_chardef (differs as in BNF characters can be written as "020" instead of '\020')
  • ruleref (`lexerrule`)
  • quantifier (*+?)
  • cstylecomment
  • comment
  • shellstylecomment
  • octdigits
  • bindigits
  • number
  • float
  • integer
  • xmlchar
  • combiningchar
  • extenderchar



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.