summaryrefslogtreecommitdiff
path: root/src/main/java/io/devnulllabs/openjava/syntax/PrepPhraseRule.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/devnulllabs/openjava/syntax/PrepPhraseRule.java')
-rw-r--r--src/main/java/io/devnulllabs/openjava/syntax/PrepPhraseRule.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/main/java/io/devnulllabs/openjava/syntax/PrepPhraseRule.java b/src/main/java/io/devnulllabs/openjava/syntax/PrepPhraseRule.java
new file mode 100644
index 0000000..d2289fb
--- /dev/null
+++ b/src/main/java/io/devnulllabs/openjava/syntax/PrepPhraseRule.java
@@ -0,0 +1,51 @@
+/*
+ * PrepPhraseRule.java
+ *
+ * comments here.
+ *
+ * @author Michiaki Tatsubori
+ * @version %VERSION% %DATE%
+ * @see java.lang.Object
+ *
+ * COPYRIGHT 1999 by Michiaki Tatsubori, ALL RIGHTS RESERVED.
+ */
+package io.devnulllabs.openjava.syntax;
+
+import io.devnulllabs.openjava.ptree.ParseTree;
+
+/**
+ * The class <code>PrepPhraseRule</code> represents the syntax rule
+ * of a prepositional phrase.
+ * Suppose there's a syntax rule <code>A</code> and a given identifier
+ * <code>i</code>. This class can represent the syntax:
+ * <pre>
+ * PrepPhraseRule := i A
+ * </pre>
+ * <p>
+ *
+ * @author Michiaki Tatsubori
+ * @version 1.0
+ * @since $Id: PrepPhraseRule.java,v 1.2 2003/02/19 02:54:31 tatsubori Exp $
+ * @see java.lang.Object
+ */
+public class PrepPhraseRule extends AbstractSyntaxRule {
+
+ private String prep;
+ private SyntaxRule words;
+
+ /**
+ * Allocates a new rule representing the syntax of a prepositional
+ * phrase consisting of a preposition and a syntax.
+ */
+ public PrepPhraseRule(String prep, SyntaxRule words) {
+ this.prep = prep;
+ this.words = words;
+ }
+
+ public ParseTree consume(TokenSource token_src) throws SyntaxException {
+ IdentifierRule ident = new IdentifierRule(prep);
+ ident.consume(token_src);
+ return words.consume(token_src);
+ }
+
+}