本文整理汇总了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();
}
}