Search in sources :

Example 1 with AntlrGrammar

use of org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammar in project xtext-core by eclipse.

the class GrammarNaming method getLexerGrammar.

public AntlrGrammar getLexerGrammar(final Grammar it) {
    AntlrGrammar _xifexpression = null;
    boolean _isCombinedGrammar = this.isCombinedGrammar(it);
    if (_isCombinedGrammar) {
        _xifexpression = this.getParserGrammar(it);
    } else {
        String _internalLexerPackage = this.getInternalLexerPackage(it);
        StringConcatenation _builder = new StringConcatenation();
        String _grammarNamePrefix = this.getGrammarNamePrefix(it);
        _builder.append(_grammarNamePrefix);
        _builder.append("Internal");
        String _simpleName = GrammarUtil.getSimpleName(it);
        _builder.append(_simpleName);
        _builder.append("Lexer");
        _xifexpression = new AntlrGrammar(_internalLexerPackage, _builder.toString());
    }
    return _xifexpression;
}
Also used : AntlrGrammar(org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammar) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 2 with AntlrGrammar

use of org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammar in project xtext-core by eclipse.

the class GrammarNaming method getParserGrammar.

public AntlrGrammar getParserGrammar(final Grammar it) {
    String _internalParserPackage = this.getInternalParserPackage(it);
    StringConcatenation _builder = new StringConcatenation();
    String _grammarNamePrefix = this.getGrammarNamePrefix(it);
    _builder.append(_grammarNamePrefix);
    _builder.append("Internal");
    String _simpleName = GrammarUtil.getSimpleName(it);
    _builder.append(_simpleName);
    {
        boolean _isCombinedGrammar = this.isCombinedGrammar(it);
        boolean _not = (!_isCombinedGrammar);
        if (_not) {
            _builder.append("Parser");
        }
    }
    return new AntlrGrammar(_internalParserPackage, _builder.toString());
}
Also used : AntlrGrammar(org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammar) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Aggregations

StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)2 AntlrGrammar (org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammar)2