Search in sources :

Example 56 with StringReader

use of java.io.StringReader in project groovy-core by groovy.

the class EnumSourceParsingTest method testParseEnumImplementsMultiLine.

public void testParseEnumImplementsMultiLine() {
    StringReader reader = new StringReader("enum ParseCode implements I\n" + "{\n" + "    COMPLETE,\n" + "    INCOMPLETE,\n" + "    ERROR\n" + "}");
    parse("testParseEnumImplementsMultiLine", reader);
}
Also used : StringReader(java.io.StringReader)

Example 57 with StringReader

use of java.io.StringReader in project groovy-core by groovy.

the class EnumSourceParsingTest method testParseEnumMultiLine.

public void testParseEnumMultiLine() {
    StringReader reader = new StringReader("enum ParseCode\n" + "{\n" + "    COMPLETE,\n" + "    INCOMPLETE,\n" + "    ERROR\n" + "}");
    parse("testParseEnumMultiLine", reader);
}
Also used : StringReader(java.io.StringReader)

Example 58 with StringReader

use of java.io.StringReader in project groovy-core by groovy.

the class EnumSourceParsingTest method testParseEnumImplements.

public void testParseEnumImplements() {
    StringReader reader = new StringReader("enum Two implements I1 {\n" + "ONE, TWO, THREE\n" + "}");
    parse("testParseEnumImplements", reader);
}
Also used : StringReader(java.io.StringReader)

Example 59 with StringReader

use of java.io.StringReader in project groovy-core by groovy.

the class GroovyRootDocBuilder method getGroovyParser.

private GroovyRecognizer getGroovyParser(String input, SourceBuffer sourceBuffer) {
    UnicodeEscapingReader unicodeReader = new UnicodeEscapingReader(new StringReader(input), sourceBuffer);
    GroovyLexer lexer = new GroovyLexer(unicodeReader);
    unicodeReader.setLexer(lexer);
    GroovyRecognizer parser = GroovyRecognizer.make(lexer);
    parser.setSourceBuffer(sourceBuffer);
    return parser;
}
Also used : GroovyLexer(org.codehaus.groovy.antlr.parser.GroovyLexer) StringReader(java.io.StringReader) GroovyRecognizer(org.codehaus.groovy.antlr.parser.GroovyRecognizer) UnicodeEscapingReader(org.codehaus.groovy.antlr.UnicodeEscapingReader)

Example 60 with StringReader

use of java.io.StringReader in project groovy-core by groovy.

the class GroovyRootDocBuilder method getJavaParser.

private JavaRecognizer getJavaParser(String input, SourceBuffer sourceBuffer) {
    UnicodeEscapingReader unicodeReader = new UnicodeEscapingReader(new StringReader(input), sourceBuffer);
    JavaLexer lexer = new JavaLexer(unicodeReader);
    unicodeReader.setLexer(lexer);
    JavaRecognizer parser = JavaRecognizer.make(lexer);
    parser.setSourceBuffer(sourceBuffer);
    return parser;
}
Also used : JavaLexer(org.codehaus.groovy.antlr.java.JavaLexer) StringReader(java.io.StringReader) JavaRecognizer(org.codehaus.groovy.antlr.java.JavaRecognizer) UnicodeEscapingReader(org.codehaus.groovy.antlr.UnicodeEscapingReader)

Aggregations

StringReader (java.io.StringReader)4150 Test (org.junit.Test)1003 IOException (java.io.IOException)589 Reader (java.io.Reader)445 InputSource (org.xml.sax.InputSource)408 BufferedReader (java.io.BufferedReader)342 TokenStream (org.apache.lucene.analysis.TokenStream)302 ArrayList (java.util.ArrayList)273 StringWriter (java.io.StringWriter)251 Tokenizer (org.apache.lucene.analysis.Tokenizer)241 Document (org.w3c.dom.Document)232 JSONReader (com.alibaba.fastjson.JSONReader)195 DocumentBuilder (javax.xml.parsers.DocumentBuilder)180 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)157 Map (java.util.Map)144 HashMap (java.util.HashMap)136 Element (org.w3c.dom.Element)134 StreamSource (javax.xml.transform.stream.StreamSource)132 ParserResult (org.jabref.logic.importer.ParserResult)130 MockTokenizer (org.apache.lucene.analysis.MockTokenizer)120