Source Code Cross Referenced for Result.java in  » Parser » Rats-Parser-Generators » xtc » parser » 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 » Rats Parser Generators » xtc.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * xtc - The eXTensible Compiler
003:         * Copyright (C) 2004-2007 Robert Grimm
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public License
007:         * version 2.1 as published by the Free Software Foundation.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
017:         * USA.
018:         */
019:        package xtc.parser;
020:
021:        /**
022:         * The superclass of all parser results.
023:         *
024:         * @author Robert Grimm
025:         * @version $Revision: 1.22 $
026:         */
027:        public abstract class Result {
028:
029:            /** The index into the parser's memoization table. */
030:            public final int index;
031:
032:            /**
033:             * Create a new result with the specified index.
034:             *
035:             * @param index The index.
036:             */
037:            public Result(int index) {
038:                this .index = index;
039:            }
040:
041:            /**
042:             * Determine whether this result has a value.
043:             *
044:             * @return <code>true</code> if this result has a value.
045:             */
046:            public abstract boolean hasValue();
047:
048:            /**
049:             * Determine whether this result has the specified string value.
050:             * The specified value must not be <code>null</code>.
051:             *
052:             * @param s The string value.
053:             * @return <code>true</code> if this result has the specified string
054:             *   value.
055:             */
056:            public abstract boolean hasValue(String s);
057:
058:            /**
059:             * Determine whether this result has the specified string value,
060:             * ignoring case.  The specified value must not be
061:             * <code>null</code>.
062:             *
063:             * @param s The string value.
064:             * @return <code>true</code> if this result has the specified string
065:             *   value, ignoring case.
066:             */
067:            public abstract boolean hasValueIgnoreCase(String s);
068:
069:            /**
070:             * Get the semantic value for this result.
071:             *
072:             * @return The semantic value for this result.
073:             * @throws IllegalStateException
074:             *   Signals that this result does not have a semantic value.
075:             */
076:            public abstract <T> T semanticValue();
077:
078:            /**
079:             * Get the parse error for this result.  If the result does not
080:             * represent a parse error or does not have an embedded parse error,
081:             * this method must return the {@link ParseError#DUMMY dummy parse
082:             * error}.
083:             *
084:             * @return The parse error for this result.
085:             */
086:            public abstract ParseError parseError();
087:
088:            /**
089:             * Select the more specific parse error.  This method compares this
090:             * result (i.e., either the parse error or the embedded parse error)
091:             * with the specified parse error and returns the one representing
092:             * the longer parse.
093:             *
094:             * @param error The error.
095:             * @return The more specific parse error.
096:             */
097:            public abstract ParseError select(ParseError error);
098:
099:            /**
100:             * Create a semantic value based on this result.  A straight-forward
101:             * implementation of this method simply creates a new semantic
102:             * value, using the specified actual value, this result's index,
103:             * and the specified parse error:<pre>
104:             *   public SemanticValue value(Object value, ParseError error) {
105:             *     return new SemanticValue(value, index, error);
106:             *   }
107:             * </pre>However, for a result that already is a semantic value, a
108:             * more sophisticated implementation can avoid creating a new
109:             * semantic value if the specified actual value and parse error are
110:             * <i>identical</i> to those for this result.
111:             *
112:             * @param value The actual value.
113:             * @param error The embedded parse error.
114:             * @throws IllegalStateException Signals that this result is a
115:             *   parse error.
116:             */
117:            public abstract SemanticValue createValue(Object value,
118:                    ParseError error);
119:
120:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.