Commit 2b52cec5 authored by Fred Eisele's avatar Fred Eisele
Browse files

Corrected lookup error with typeside.

parent 15ecc87d
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql/gen_src/catdata/aql/grammar/c6m/-ru88jt/AqlLexerRules.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/90x/-ru88jt/AqlLexerRules.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql/gen_src/catdata/aql/grammar/c6m/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/90x/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
......@@ -5674,8 +5674,8 @@ public class AqlParser extends Parser {
public static class Schema_EmptyContext extends SchemaDefContext {
public TerminalNode EMPTY() { return getToken(AqlParser.EMPTY, 0); }
public TerminalNode COLON() { return getToken(AqlParser.COLON, 0); }
public TypesideKindContext typesideKind() {
return getRuleContext(TypesideKindContext.class,0);
public TypesideRefContext typesideRef() {
return getRuleContext(TypesideRefContext.class,0);
}
public Schema_EmptyContext(SchemaDefContext ctx) { copyFrom(ctx); }
@Override
......@@ -5750,7 +5750,7 @@ public class AqlParser extends Parser {
setState(984);
match(COLON);
setState(985);
typesideKind();
typesideRef();
}
break;
case SCHEMA_OF:
......@@ -5870,29 +5870,53 @@ public class AqlParser extends Parser {
}
 
public static class SchemaKindContext extends ParserRuleContext {
public SchemaKindContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_schemaKind; }
public SchemaKindContext() { }
public void copyFrom(SchemaKindContext ctx) {
super.copyFrom(ctx);
}
}
public static class SchemaKind_RefContext extends SchemaKindContext {
public SchemaRefContext schemaRef() {
return getRuleContext(SchemaRefContext.class,0);
}
public SchemaKind_RefContext(SchemaKindContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof AqlParserListener ) ((AqlParserListener)listener).enterSchemaKind_Ref(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof AqlParserListener ) ((AqlParserListener)listener).exitSchemaKind_Ref(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof AqlParserVisitor ) return ((AqlParserVisitor<? extends T>)visitor).visitSchemaKind_Ref(this);
else return visitor.visitChildren(this);
}
}
public static class SchemaKind_DefContext extends SchemaKindContext {
public SchemaDefContext schemaDef() {
return getRuleContext(SchemaDefContext.class,0);
}
public TerminalNode LPAREN() { return getToken(AqlParser.LPAREN, 0); }
public TerminalNode RPAREN() { return getToken(AqlParser.RPAREN, 0); }
public SchemaKindContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_schemaKind; }
public SchemaKind_DefContext(SchemaKindContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof AqlParserListener ) ((AqlParserListener)listener).enterSchemaKind(this);
if ( listener instanceof AqlParserListener ) ((AqlParserListener)listener).enterSchemaKind_Def(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof AqlParserListener ) ((AqlParserListener)listener).exitSchemaKind(this);
if ( listener instanceof AqlParserListener ) ((AqlParserListener)listener).exitSchemaKind_Def(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof AqlParserVisitor ) return ((AqlParserVisitor<? extends T>)visitor).visitSchemaKind(this);
if ( visitor instanceof AqlParserVisitor ) return ((AqlParserVisitor<? extends T>)visitor).visitSchemaKind_Def(this);
else return visitor.visitChildren(this);
}
}
......@@ -5907,6 +5931,7 @@ public class AqlParser extends Parser {
case UPPER_ID:
case LOWER_ID:
case SPECIAL_ID:
_localctx = new SchemaKind_RefContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(1006);
......@@ -5918,6 +5943,7 @@ public class AqlParser extends Parser {
case DST:
case SCHEMA_OF:
case GET_SCHEMA:
_localctx = new SchemaKind_DefContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(1007);
......@@ -5925,6 +5951,7 @@ public class AqlParser extends Parser {
}
break;
case LPAREN:
_localctx = new SchemaKind_DefContext(_localctx);
enterOuterAlt(_localctx, 3);
{
{
......@@ -20197,7 +20224,7 @@ public class AqlParser extends Parser {
"\u008d\3\2\2\2\u03d2\u03d3\5\4\3\2\u03d3\u008f\3\2\2\2\u03d4\u03d5\7\u008a"+
"\2\2\u03d5\u03d6\5\u008cG\2\u03d6\u03d7\7\u00b2\2\2\u03d7\u03d8\5\u0092"+
"J\2\u03d8\u0091\3\2\2\2\u03d9\u03da\7\32\2\2\u03da\u03db\7\u00a5\2\2\u03db"+
"\u03ef\5^\60\2\u03dc\u03df\7\u008b\2\2\u03dd\u03e0\7\u008d\2\2\u03de\u03e0"+
"\u03ef\5X-\2\u03dc\u03df\7\u008b\2\2\u03dd\u03e0\7\u008d\2\2\u03de\u03e0"+
"\5\u00c0a\2\u03df\u03dd\3\2\2\2\u03df\u03de\3\2\2\2\u03e0\u03ef\3\2\2"+
"\2\u03e1\u03e2\7\34\2\2\u03e2\u03ef\5\u014c\u00a7\2\u03e3\u03e4\7\21\2"+
"\2\u03e4\u03e5\7\u00a5\2\2\u03e5\u03ea\5^\60\2\u03e6\u03e7\7\u00ab\2\2"+
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql/gen_src/catdata/aql/grammar/c6m/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/90x/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.ParserRuleContext;
......@@ -1132,13 +1132,25 @@ public class AqlParserBaseListener implements AqlParserListener {
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterSchemaKind(AqlParser.SchemaKindContext ctx) { }
@Override public void enterSchemaKind_Ref(AqlParser.SchemaKind_RefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSchemaKind(AqlParser.SchemaKindContext ctx) { }
@Override public void exitSchemaKind_Ref(AqlParser.SchemaKind_RefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterSchemaKind_Def(AqlParser.SchemaKind_DefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSchemaKind_Def(AqlParser.SchemaKind_DefContext ctx) { }
/**
* {@inheritDoc}
*
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql/gen_src/catdata/aql/grammar/c6m/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/90x/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
......@@ -668,7 +668,14 @@ public class AqlParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> impleme
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitSchemaKind(AqlParser.SchemaKindContext ctx) { return visitChildren(ctx); }
@Override public T visitSchemaKind_Ref(AqlParser.SchemaKind_RefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitSchemaKind_Def(AqlParser.SchemaKind_DefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql/gen_src/catdata/aql/grammar/c6m/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/90x/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.tree.ParseTreeListener;
......@@ -988,15 +988,29 @@ public interface AqlParserListener extends ParseTreeListener {
*/
void exitSchema_GetSchemaColimit(AqlParser.Schema_GetSchemaColimitContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#schemaKind}.
* Enter a parse tree produced by the {@code SchemaKind_Ref}
* labeled alternative in {@link AqlParser#schemaKind}.
* @param ctx the parse tree
*/
void enterSchemaKind(AqlParser.SchemaKindContext ctx);
void enterSchemaKind_Ref(AqlParser.SchemaKind_RefContext ctx);
/**
* Exit a parse tree produced by {@link AqlParser#schemaKind}.
* Exit a parse tree produced by the {@code SchemaKind_Ref}
* labeled alternative in {@link AqlParser#schemaKind}.
* @param ctx the parse tree
*/
void exitSchemaKind(AqlParser.SchemaKindContext ctx);
void exitSchemaKind_Ref(AqlParser.SchemaKind_RefContext ctx);
/**
* Enter a parse tree produced by the {@code SchemaKind_Def}
* labeled alternative in {@link AqlParser#schemaKind}.
* @param ctx the parse tree
*/
void enterSchemaKind_Def(AqlParser.SchemaKind_DefContext ctx);
/**
* Exit a parse tree produced by the {@code SchemaKind_Def}
* labeled alternative in {@link AqlParser#schemaKind}.
* @param ctx the parse tree
*/
void exitSchemaKind_Def(AqlParser.SchemaKind_DefContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#schemaColimitRef}.
* @param ctx the parse tree
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql/gen_src/catdata/aql/grammar/c6m/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/90x/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
......@@ -594,11 +594,19 @@ public interface AqlParserVisitor<T> extends ParseTreeVisitor<T> {
*/
T visitSchema_GetSchemaColimit(AqlParser.Schema_GetSchemaColimitContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#schemaKind}.
* Visit a parse tree produced by the {@code SchemaKind_Ref}
* labeled alternative in {@link AqlParser#schemaKind}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSchemaKind(AqlParser.SchemaKindContext ctx);
T visitSchemaKind_Ref(AqlParser.SchemaKind_RefContext ctx);
/**
* Visit a parse tree produced by the {@code SchemaKind_Def}
* labeled alternative in {@link AqlParser#schemaKind}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSchemaKind_Def(AqlParser.SchemaKind_DefContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#schemaColimitRef}.
* @param ctx the parse tree
......
......@@ -7,15 +7,19 @@ schemaRef : symbol ;
schemaKindAssignment : SCHEMA schemaId EQUAL schemaDef ;
schemaDef
: EMPTY COLON typesideKind #Schema_Empty
| SCHEMA_OF (INSTANCE_ALL | instanceKind) #Schema_OfInstance
: EMPTY COLON typesideRef #Schema_Empty
| SCHEMA_OF (INSTANCE_ALL | instanceKind) #Schema_OfInstance
| DST queryRef #Schema_Destination
| LITERAL COLON typesideKind
(LBRACE schemaLiteralSection RBRACE)? #Schema_Literal
(LBRACE schemaLiteralSection RBRACE)? #Schema_Literal
| GET_SCHEMA schemaColimitRef #Schema_GetSchemaColimit
;
schemaKind : schemaRef | schemaDef | (LPAREN schemaDef RPAREN) ;
schemaKind
: schemaRef # SchemaKind_Ref
| schemaDef # SchemaKind_Def
| (LPAREN schemaDef RPAREN) # SchemaKind_Def
;
schemaColimitRef : symbol ;
......
......@@ -15,6 +15,10 @@ import org.antlr.v4.runtime.tree.ParseTreeProperty;
import catdata.Pair;
import catdata.Triple;
import catdata.aql.RawTerm;
import catdata.aql.exp.SchExp.SchExpEmpty;
import catdata.aql.exp.TyExp.TyExpVar;
import catdata.aql.exp.TyExpRaw.Sym;
import catdata.aql.exp.TyExpRaw.Ty;
import catdata.aql.grammar.AqlParser;
import catdata.aql.grammar.AqlParser.TypesideLiteralSectionContext;
import catdata.aql.grammar.AqlParserBaseListener;
......@@ -47,6 +51,7 @@ public class AqlLoaderListener extends AqlParserBaseListener {
public final List<Triple<String, Integer, Exp<?>>> decls;
public final List<Pair<String, String>> global_options;
public Function<Exp<?>, String> kind;
public final Map<String, Exp<?>> ns = new HashMap<String, Exp<?>>();
/**
......@@ -135,7 +140,7 @@ public class AqlLoaderListener extends AqlParserBaseListener {
.map(elt ->
new Pair<Integer,TyExp<?,?>>(
elt.getStart().getStartIndex(),
(TyExp<?,?>) ns.get(elt.getText())))
new TyExpVar<Ty,Sym>(elt.getText())))
.collect(Collectors.toList());
final List<LocStr> types = ctx_lit
......@@ -226,6 +231,34 @@ public class AqlLoaderListener extends AqlParserBaseListener {
this.exps.put(ctx,typeside);
};
/**
* Schema section
*/
@Override public void exitSchemaKindAssignment(AqlParser.SchemaKindAssignmentContext ctx) {
final String name = ctx.schemaId().getText();
final int id = getLUid(ctx);
final Exp<?> exp = this.exps.get(ctx.schemaDef());
if (exp == null) {
log.warning("null schema exp " + name);
return;
}
ns.put(name, exp);
this.decls.add(new Triple<String,Integer,Exp<?>>(name,id,exp));
}
@Override
public void exitSchemaKind_Def(AqlParser.SchemaKind_DefContext ctx) {
this.exps.put(ctx,this.exps.get(ctx.schemaDef()));
}
@Override
public void exitSchema_Empty(AqlParser.Schema_EmptyContext ctx) {
final TyExp<Ty,Sym> ty = new TyExpVar<Ty,Sym>(ctx.typesideRef().getText());
final Exp<?> exp = new SchExpEmpty<Ty,Sym>(ty);
this.exps.put(ctx,exp);
};
@Override
public void exitProgram(AqlParser.ProgramContext ctx) {
if (true) ;
......
......@@ -7,7 +7,9 @@ public abstract class AqlParserFactory {
COMBINATOR,
ANTLR4
}
public static Mode mode = Mode.ANTLR4;
public static Mode mode =
Mode.ANTLR4;
// Mode.COMBINATOR ;
protected AqlParserFactory() { }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment