blob: d2289fbd80a37ba19041f94274735be9e8be8096 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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);
}
}
|