summaryrefslogtreecommitdiff
path: root/src/main/java/io/devnulllabs/openjava/syntax/StatementRule.java
blob: 1207451c9587233beb0ace6497fd0d1063e44052 (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
52
53
54
55
/*
 * StatementRule.java
 *
 * comments here.
 *
 * @author   Michiaki Tatsubori
 * @version  %VERSION% %DATE%
 * @see      java.lang.Object
 *
 * COPYRIGHT 1998 by Michiaki Tatsubori, ALL RIGHTS RESERVED.
 */
package io.devnulllabs.openjava.syntax;

import io.devnulllabs.openjava.mop.Environment;
import io.devnulllabs.openjava.ptree.ParseTree;
import io.devnulllabs.openjava.ptree.Statement;

/**
 * The class <code>StatementRule</code>
 * <p>
 * For example
 * <pre>
 * </pre>
 * <p>
 *
 * @author   Michiaki Tatsubori
 * @version  1.0
 * @since    $Id: StatementRule.java,v 1.2 2003/02/19 02:54:32 tatsubori Exp $
 * @see java.lang.Object
 */
public class StatementRule extends AbstractSyntaxRule {
    private Environment env;

    public StatementRule(Environment env) {
        this.env = env;
    }

    public StatementRule() {
        this(null);
    }

    public final ParseTree consume(TokenSource token_src)
        throws SyntaxException {
        return consumeStatement(token_src);
    }

    public Statement consumeStatement(TokenSource token_src)
        throws SyntaxException {
        Statement result = JavaSyntaxRules.consumeStatement(token_src, env);
        if (result == null)
            throw JavaSyntaxRules.getLastException();
        return result;
    }

}