Class DefaultNaftahDateParserVisitor
- All Implemented Interfaces:
org.antlr.v4.runtime.tree.ParseTreeVisitor<Object>,NaftahDateParserVisitor<Object>
This class extends NaftahDateParserBaseVisitor and provides implementations for
converting parse tree nodes into corresponding NaftahTemporal objects, such as
NaftahDate, NaftahTime, and NaftahDateTime.
It handles:
- Date and calendar specifiers
- Time with optional AM/PM markers
- Time zones or offsets
- Integration of date and time into a single temporal object
- Author:
- Chakib Daii
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvisit()Starts the visiting process by parsing the program and visiting the resulting parse tree.Visit a parse tree produced byNaftahDateParser.betweenSpecifier().Visit a parse tree produced by thebetweenTemporalAmountlabeled alternative inNaftahDateParser.root().Visit a parse tree produced byNaftahDateParser.betweenTimeSpecifier().Visit a parse tree produced byNaftahDateParser.calendarSpecifier().Visit a parse tree produced byNaftahDateParser.dateAmount().Visit a parse tree produced byNaftahDateParser.dateSpecifier().Visit a parse tree produced by thedateTimelabeled alternative inNaftahDateParser.root().Visit a parse tree produced byNaftahDateParser.dateTimeSpecifier().Visit a parse tree produced by thedurationlabeled alternative inNaftahDateParser.root().Visit a parse tree produced byNaftahDateParser.durationSpecifier().Visit a parse tree produced by thenowlabeled alternative inNaftahDateParser.root().Visit a parse tree produced by thenowAsDatelabeled alternative inNaftahDateParser.nowSpecifier().Visit a parse tree produced by thenowAsDateTimelabeled alternative inNaftahDateParser.nowSpecifier().Visit a parse tree produced by thenowAsTimelabeled alternative inNaftahDateParser.nowSpecifier().Visit a parse tree produced by theoffsetSpecifierlabeled alternative inNaftahDateParser.zoneOrOffsetSpecifier().Visit a parse tree produced byNaftahDateParser.periodSpecifier().Visit a parse tree produced by theperiodWithDurationlabeled alternative inNaftahDateParser.root().Visit a parse tree produced by thetimelabeled alternative inNaftahDateParser.root().Visit a parse tree produced byNaftahDateParser.timeAmount().Visit a parse tree produced byNaftahDateParser.timeSpecifier().Visit a parse tree produced byNaftahDateParser.zonedOrOffsetTimeSpecifier().Visit a parse tree produced by thezoneSpecifierlabeled alternative inNaftahDateParser.zoneOrOffsetSpecifier().Methods inherited from class org.antlr.v4.runtime.tree.AbstractParseTreeVisitor
aggregateResult, defaultResult, shouldVisitNextChild, visit, visitChildren, visitErrorNode, visitTerminalMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.antlr.v4.runtime.tree.ParseTreeVisitor
visit, visitChildren, visitErrorNode, visitTerminal
-
Field Details
-
parser
-
-
Constructor Details
-
DefaultNaftahDateParserVisitor
-
-
Method Details
-
visit
Starts the visiting process by parsing the program and visiting the resulting parse tree.- Returns:
- the result of visiting the parse tree
-
visitNow
Visit a parse tree produced by thenowlabeled alternative inNaftahDateParser.root().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitNowin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitNowin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitNowAsDateTime
Visit a parse tree produced by thenowAsDateTimelabeled alternative inNaftahDateParser.nowSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitNowAsDateTimein interfaceNaftahDateParserVisitor<Object>- Overrides:
visitNowAsDateTimein classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitNowAsDate
Visit a parse tree produced by thenowAsDatelabeled alternative inNaftahDateParser.nowSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitNowAsDatein interfaceNaftahDateParserVisitor<Object>- Overrides:
visitNowAsDatein classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitNowAsTime
Visit a parse tree produced by thenowAsTimelabeled alternative inNaftahDateParser.nowSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitNowAsTimein interfaceNaftahDateParserVisitor<Object>- Overrides:
visitNowAsTimein classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitDateTime
Visit a parse tree produced by thedateTimelabeled alternative inNaftahDateParser.root().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitDateTimein interfaceNaftahDateParserVisitor<Object>- Overrides:
visitDateTimein classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitTime
Visit a parse tree produced by thetimelabeled alternative inNaftahDateParser.root().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitTimein interfaceNaftahDateParserVisitor<Object>- Overrides:
visitTimein classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitDateTimeSpecifier
Visit a parse tree produced byNaftahDateParser.dateTimeSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitDateTimeSpecifierin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitDateTimeSpecifierin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitDateSpecifier
Visit a parse tree produced byNaftahDateParser.dateSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitDateSpecifierin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitDateSpecifierin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitZonedOrOffsetTimeSpecifier
public NaftahTime visitZonedOrOffsetTimeSpecifier(NaftahDateParser.ZonedOrOffsetTimeSpecifierContext ctx) Visit a parse tree produced byNaftahDateParser.zonedOrOffsetTimeSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitZonedOrOffsetTimeSpecifierin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitZonedOrOffsetTimeSpecifierin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitTimeSpecifier
Visit a parse tree produced byNaftahDateParser.timeSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitTimeSpecifierin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitTimeSpecifierin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitZoneSpecifier
Visit a parse tree produced by thezoneSpecifierlabeled alternative inNaftahDateParser.zoneOrOffsetSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitZoneSpecifierin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitZoneSpecifierin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitOffsetSpecifier
Visit a parse tree produced by theoffsetSpecifierlabeled alternative inNaftahDateParser.zoneOrOffsetSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitOffsetSpecifierin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitOffsetSpecifierin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitCalendarSpecifier
Visit a parse tree produced byNaftahDateParser.calendarSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitCalendarSpecifierin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitCalendarSpecifierin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitPeriodWithDuration
Visit a parse tree produced by theperiodWithDurationlabeled alternative inNaftahDateParser.root().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitPeriodWithDurationin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitPeriodWithDurationin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitDuration
Visit a parse tree produced by thedurationlabeled alternative inNaftahDateParser.root().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitDurationin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitDurationin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitBetweenTemporalAmount
public NaftahTemporalAmount visitBetweenTemporalAmount(NaftahDateParser.BetweenTemporalAmountContext ctx) Visit a parse tree produced by thebetweenTemporalAmountlabeled alternative inNaftahDateParser.root().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitBetweenTemporalAmountin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitBetweenTemporalAmountin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitDurationSpecifier
Visit a parse tree produced byNaftahDateParser.durationSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitDurationSpecifierin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitDurationSpecifierin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitTimeAmount
Visit a parse tree produced byNaftahDateParser.timeAmount().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitTimeAmountin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitTimeAmountin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitPeriodSpecifier
Visit a parse tree produced byNaftahDateParser.periodSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitPeriodSpecifierin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitPeriodSpecifierin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitDateAmount
Visit a parse tree produced byNaftahDateParser.dateAmount().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitDateAmountin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitDateAmountin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitBetweenSpecifier
Visit a parse tree produced byNaftahDateParser.betweenSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitBetweenSpecifierin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitBetweenSpecifierin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitBetweenTimeSpecifier
public NaftahTemporalPoint visitBetweenTimeSpecifier(NaftahDateParser.BetweenTimeSpecifierContext ctx) Visit a parse tree produced byNaftahDateParser.betweenTimeSpecifier().The default implementation returns the result of calling
AbstractParseTreeVisitor.visitChildren(org.antlr.v4.runtime.tree.RuleNode)onctx.- Specified by:
visitBetweenTimeSpecifierin interfaceNaftahDateParserVisitor<Object>- Overrides:
visitBetweenTimeSpecifierin classNaftahDateParserBaseVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-