本文整理匯總了Java中som.compiler.Parser.ParseError類的典型用法代碼示例。如果您正苦於以下問題:Java ParseError類的具體用法?Java ParseError怎麽用?Java ParseError使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ParseError類屬於som.compiler.Parser包,在下文中一共展示了ParseError類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: tupleType
import som.compiler.Parser.ParseError; //導入依賴的package包/類
private void tupleType() throws ParseError {
parser.expect(LCurly, null);
if (parser.sym != RCurly) {
while (true) {
typeExpr();
if (parser.sym == Period) {
parser.expect(Period, null);
} else {
break;
}
}
}
parser.expect(RCurly, null);
}
示例2: typeExpr
import som.compiler.Parser.ParseError; //導入依賴的package包/類
private void typeExpr() throws ParseError {
typeTerm();
if (parser.sym == Or) {
parser.expect(Or, null);
typeExpr();
} else if (parser.sym == LCurly) {
tupleType();
} else if (parser.sym == Colon) {
parser.expect(Colon, null);
typeExpr();
} else if (parser.sym == Div) {
parser.expect(Div, null);
typeExpr();
}
}
示例3: compile
import som.compiler.Parser.ParseError; //導入依賴的package包/類
private static SClass compile(final Parser parser, final SClass systemClass,
final Universe universe) {
ClassGenerationContext cgc = new ClassGenerationContext(universe);
SClass result = systemClass;
try {
parser.classdef(cgc);
} catch (ParseError pe) {
Universe.errorExit(pe.toString());
}
if (systemClass == null) {
result = cgc.assemble();
} else {
cgc.assembleSystemClass(result);
}
return result;
}
示例4: toDiagnostics
import som.compiler.Parser.ParseError; //導入依賴的package包/類
private List<Diagnostic> toDiagnostics(final ParseError e,
final List<Diagnostic> diagnostics) {
Diagnostic d = new Diagnostic();
d.setSeverity(DiagnosticSeverity.Error);
SourceCoordinate coord = e.getSourceCoordinate();
d.setRange(toRangeMax(coord));
d.setMessage(e.getMessage());
d.setSource("Parser");
diagnostics.add(d);
return diagnostics;
}
示例5: nonEmptyBlockArgList
import som.compiler.Parser.ParseError; //導入依賴的package包/類
private void nonEmptyBlockArgList() throws ParseError {
while (parser.sym == Colon) {
parser.expect(Colon, null);
typeTerm();
}
if (parser.sym == Or) {
blockReturnType();
}
}
示例6: blockType
import som.compiler.Parser.ParseError; //導入依賴的package包/類
private void blockType() throws ParseError {
parser.expect(NewBlock, null);
if (parser.sym == Colon) {
nonEmptyBlockArgList();
} else if (parser.sym != EndBlock) {
blockReturnType();
}
parser.expect(EndBlock, null);
}
示例7: typeArguments
import som.compiler.Parser.ParseError; //導入依賴的package包/類
private void typeArguments() throws ParseError {
parser.expect(NewBlock, null);
while (true) {
typeExpr();
if (parser.sym == Comma) {
parser.expect(Comma, null);
} else {
break;
}
}
parser.expect(EndBlock, null);
}
示例8: typeFactor
import som.compiler.Parser.ParseError; //導入依賴的package包/類
private void typeFactor() throws ParseError {
if (parser.sym == Identifier) {
typePrimary();
} else if (parser.sym == LCurly) {
tupleType();
} else if (parser.sym == NewBlock) {
blockType();
} else if (parser.sym == NewTerm) {
parser.expect(NewTerm, null);
typeExpr();
parser.expect(EndTerm, null);
}
}
示例9: typeTerm
import som.compiler.Parser.ParseError; //導入依賴的package包/類
private void typeTerm() throws ParseError {
typeFactor();
while (parser.sym == Identifier) {
parser.expect(Identifier, null);
}
}
示例10: testNormalType
import som.compiler.Parser.ParseError; //導入依賴的package包/類
@Test
public void testNormalType() throws RuntimeException,
MissingMIMETypeException, MissingNameException, ParseError {
// add a space so that lexer stops lexing
String testString = content + " ";
TypeParser tp = createParser(testString);
tp.parseType();
}
示例11: testReturnType
import som.compiler.Parser.ParseError; //導入依賴的package包/類
@Test
public void testReturnType() throws RuntimeException,
MissingMIMETypeException, MissingNameException, ParseError {
// add a space so that lexer stops lexing
String testString = "^ " + content + " ";
TypeParser tp = createParser(testString);
tp.parseReturnType();
}
示例12: createParser
import som.compiler.Parser.ParseError; //導入依賴的package包/類
private TypeParser createParser(final String testString)
throws MissingMIMETypeException, MissingNameException, ParseError {
Source s =
Source.newBuilder(testString).name("test.ns").mimeType(SomLanguage.MIME_TYPE).build();
Parser p = new Parser(
testString, testString.length(), s, new StructuralProbe(),
new SomLanguage());
TypeParser tp = new TypeParser(p);
return tp;
}
示例13: parseType
import som.compiler.Parser.ParseError; //導入依賴的package包/類
public void parseType() throws ParseError {
if (parser.sym == Less) {
expectType();
}
}
示例14: blockReturnType
import som.compiler.Parser.ParseError; //導入依賴的package包/類
private void blockReturnType() throws ParseError {
typeExpr();
}
示例15: typePrimary
import som.compiler.Parser.ParseError; //導入依賴的package包/類
private void typePrimary() throws ParseError {
parser.expect(Identifier, null);
if (parser.sym == NewBlock) {
typeArguments();
}
}