Comments (2)
The lexing process is strongly based around the three core types of
statement, structure and token.
Adding something else to that trio would be either heavy to implement or
high risk.
One key thing to note is that the following is required for a full
statement...
...; print "Hello World!\n";
Using ... on it's own results in a syntax error.
... print "Hello World!\n";
Thus, ... is not a statement, but is some form of Token (perhaps a unique
one, PPI::Token::Unimplemented), with perhaps a matching
PPI::Statement::Unimplemented to wrap over it.
Sometimes it's best to examine how perl itself handles real world cases to
clear up any potential confusion emanating from the documentation.
Adam
On 16 February 2014 18:06, moregan [email protected] wrote:
Perl 5.12 introduced the ellipsis statement, "...". Currently "..." always
parses as a PPI::Token::Operator. perl5120delta.pod refers to it as an
operator, but perlsyn is pretty clear that it's really a statement, making
the use of Operator wrong.It's not too bad that the ellipsis becomes a child of a simple
PPI::Statement, but, given the fact that it throws, would it be more
appropriate to have it be a child of PPI::Statement::Break? A new statement
type altogether?The existing token types don't seem to fit the ellipsis. Should there be a
PPI::Token::Ellipsis (subclass of PPI::Token)?comments?
Reply to this email directly or view it on GitHubhttps://github.com//issues/41
.
from ppi.
Seems fine to me to use statement + token, as in:
ppidump 'die'
PPI::Document
PPI::Statement
[ 1, 1, 1 ] PPI::Token::Word 'die'
I went for PPI::Token::Ellipsis initially because "Unimplemented" seemed like a parsing failure. I'm not picky about it, though.
Could use PPI::Statement (simplicity, Occam's Razor; vs. doesn't convey much information), PPI::Statement::Break (close to common semantics with goto, etc.; vs transfer of control is to someplace not actually in the program), or PPI::Statement::Unimplemented (unambiguous; vs. one more type for everything to know about.)
from ppi.
Related Issues (20)
- CHECK bareword handle parsed as scheduled statement HOT 1
- No unknown public methods test failing HOT 1
- Indented here-doc loses whitespace before final delimiter
- provide delimiters for PPI::Token::QuoteLike::{Words,Regexp,Command}, PPI::Token::Quote::{Literal,Interpolate}
- dies with unicode bare key name HOT 1
- use signatures not supported by PPI HOT 1
- Lexical subroutine doesn't return correct name HOT 2
- Misparse bareword as label HOT 7
- Maybe bump minimum Perl version to 5.008?
- try/catch syntax misparsed
- Extending PPI HOT 2
- Parse DSL as a sub HOT 2
- The Keyword Question HOT 20
- Verify behaviour of BEGIN, UNITCHECK, CHECK, INIT and END
- TODO: tidy everything
- TODO: remove superfluous `#pod` lines
- TODO: verify INHERITANCE documentation for all classes
- TODO: auto-generate copyright, author, contributor notices (see strictures.pm)
- TODO: probably un-inline Inlined $self->__add_element(shift);
- TODO: create test cases for the constructs in Syntax::Construct
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ppi.