You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2017/05/22 02:54:04 UTC

[jira] [Resolved] (CALCITE-1788) Simplify handling of position in the parser

     [ https://issues.apache.org/jira/browse/CALCITE-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Hyde resolved CALCITE-1788.
----------------------------------
       Resolution: Fixed
    Fix Version/s: 1.13.0

Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/d6193040.

This is a breaking change: Extension parsers will need to change the parameters to their methods from {{SqlParserPos}} to {{Span}}. [The changes made to parserImpls.ftl|https://github.com/apache/calcite/commit/d619304070bf2874ab760c92ec2573ee6c19f536#diff-1b31a88c20be48545f6a5b15b4cf8e07] should give a general idea what needs to be changed.

> Simplify handling of position in the parser
> -------------------------------------------
>
>                 Key: CALCITE-1788
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1788
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>             Fix For: 1.13.0
>
>
> Simplify handling of position in the parser by adding a class Span that keeps track of the tokens that have contributed to the current non-terminal.
> Some patterns:
> * {{final Span s;}} declaration of a Span at the top of a production
> * {{s = span();}}  initializes {{s}} to a Span that includes the token we just saw; very often occurs immediately after the first token in the production
> * {{s.end(this);}} adds the most recent token to span {{s}} and evaluates to a {{SqlParserPosition}} that spans from beginning to end; commonly used when making a call to a function
> * {{s.add(node);}} adds a SqlNode's parser position to a span
> * {{s.addAll(nodeList);}} adds several SqlNodes' parser positions to a span
> * {{s = Span.of();}} initializes s to an empty Span, not even including the most recent token; rarely used



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)