otrosien / xtext-perl

experimental perl parsing with xtext

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

parsing perl with xtext

Only perl can parse perl? Let's see.. Demo of how much of perl can be parsed using xtext.

What's the state?

I'm trying to closely following the parser structure from PPI. It's still at the very beginning of implementation. So far only the following elements have parser rules:

Statements:

  • subs
  • package declaration
  • includes (use,require,pragmas)
  • labels ('LINE:')

Structure:

  • blocks ('{' .... '}')

Token:

  • Comments
  • Reserved keywords
  • Operators, file-test operators (-e...)
  • Strings,numbers
  • Quotelike (q,qq,qx..)
  • Backticks
  • Regex (s,m,tr)...
  • DATA / END
  • POD
  • Array-Deref (@{$...})

Known issues:

  • Does not recognize regex with missing match prefix-char "m".
  • Regex and quote-like delimiters limited to the most-used combinations //,||,<>,{}
  • Package references in includes need to be on the project classpath in order for xtext to resolve them. This would need to be extended to include searching PERL5LIB.

About

experimental perl parsing with xtext

License:Apache License 2.0


Languages

Language:Xtend 57.6%Language:Shell 24.7%Language:Batchfile 17.5%Language:Perl 0.2%