Commit Graph

110 Commits

Author SHA1 Message Date
Evan Shaw
d803e53a0a Remove serde dependency 2022-09-13 22:24:31 +12:00
Evan Shaw
447b1be197 Use ByteString through lexer and parser 2022-09-13 22:03:09 +12:00
Evan Shaw
843a00c523 Add ByteString type 2022-09-13 22:03:09 +12:00
Evan Shaw
f0fc4f190d Add a test case for non-UTF-8 variable name 2022-09-13 20:22:11 +12:00
Evan Shaw
f345389c32 Allow lexer to accept bytes as input 2022-09-13 17:19:47 +12:00
Evan Shaw
4c7047fbd1 Lex and parse in terms of bytes rather than characters 2022-09-13 17:01:24 +12:00
Ryan Chandler
c5e4632c15
parser: support global statements 2022-09-13 00:46:37 +01:00
Ryan Chandler
1e94b05ba6
lexer: fix nullsafe arrow token skipping too many characters 2022-09-13 00:25:59 +01:00
Ryan Chandler
d85913665f
chore: format 2022-09-12 15:16:07 +01:00
Ryan Chandler
fb8915819d
parser: support for error suppress expressions 2022-09-12 15:15:18 +01:00
Ryan Chandler
bdce626104
lexer&parser: better support for close tags 2022-09-12 12:31:01 +01:00
Ryan Chandler
a897328b69
parser: support do/while statements 2022-09-12 12:07:29 +01:00
Ryan Chandler
0f0629ff8b
Merge pull request #31 from edsrzf/parse-include 2022-09-12 11:45:51 +01:00
Evan Shaw
af1261355a Parse include and include_once 2022-09-12 22:29:28 +12:00
Evan Shaw
eb4398b0bd Fix off-by-one error when lexing variable names
This meant a variable named $a1 was treated as two separate tokens: the
variable $a, and an integer literal.
2022-09-12 22:05:46 +12:00
Evan Shaw
eec4a90fe1 rustfmt the rest of files 2022-09-12 07:45:05 +12:00
Evan Shaw
7b20d86777 Remove nightly Rust requirement 2022-09-11 16:04:55 +12:00
Evan Shaw
7d503e0c33 Rustfmt lexer 2022-09-11 15:53:09 +12:00
Ryan Chandler
0627e05642
parser: support /= 2022-08-10 00:50:04 +01:00
Ryan Chandler
a83f1b80bb
parser: support double/float cast 2022-08-10 00:46:27 +01:00
Ryan Chandler
5a44de9650
parser: support int cast 2022-08-10 00:41:35 +01:00
Ryan Chandler
cd45e0a423
parser: add support for (bool) cast 2022-08-10 00:31:00 +01:00
Ryan Chandler
efc6e7e7b9
parser: support -= op 2022-08-10 00:26:59 +01:00
Ryan Chandler
f273edc2ee
parser: add support for *= 2022-08-10 00:25:11 +01:00
Ryan Chandler
489cb0e884
lexer: produce nullsafe -> tokens 2022-08-09 21:23:47 +01:00
Ryan Chandler
e4ad01c545
parser: support while statements 2022-08-09 20:32:49 +01:00
Ryan Chandler
0ae93c2ea1
lexer: produce shorthand ternary tokens 2022-08-09 11:58:22 +01:00
Ryan Chandler
40c52a6e69
lexer: produce object cast tokens 2022-08-09 11:49:00 +01:00
Ryan Chandler
c2cacd4e95
lexer: allow numeric characters in variables after 1st alphabetic/underscore char 2022-08-09 11:43:27 +01:00
Ryan Chandler
4aa3b3af6b
parser: support concat assign op 2022-08-09 11:35:19 +01:00
Ryan Chandler
983c6edbd3
lexer: allow numeric characters in identifiers 2022-08-09 11:31:23 +01:00
Ryan Chandler
18a841e591
all: clippy 2022-08-09 00:54:04 +01:00
Ryan Chandler
30e0e5da60
lexer: support looking ahead based on string literal 2022-08-09 00:46:50 +01:00
Ryan Chandler
fb678c1e64
lexer: move away from shared character iterator
The Peekable<Chars> setup was quite limiting since we couldn't
easily do lookaheads for certain patterns.

The new setup involves a 1-step lookahead and tracking the current
character we're looking at. In theory, this makes it easier to do
bulk lookaheads, especially useful in finding complex tokens such as
(string), <?php, etc.
2022-08-09 00:31:07 +01:00
Ryan Chandler
ce4e1e1152
parser: support minimum yield expressions 2022-08-09 00:03:25 +01:00
Ryan Chandler
9ab82059a1
parser: support throw expressions
It's worth noting that a `throw` will always be an expression in the Trunk parser.
PHP-Parser will convert standalone `throw` expressions into a dedicated `throw`
statement for backwards-compatibility reasons.
2022-08-09 00:00:14 +01:00
Ryan Chandler
06cbbeff40
parser: start supporting reserved non modifiers as method names 2022-08-08 23:53:32 +01:00
Ryan Chandler
a238ebd579
lexer: produce instanceof tokens 2022-08-06 04:40:32 +01:00
Ryan Chandler
431d449f10
parser+lexer: support switch statements
Closes #4.
2022-08-04 10:53:41 +01:00
Ryan Chandler
65fa165ba8
parser+lexer: support try/catch/finally statements
Closes #17.
2022-08-04 00:41:27 +01:00
Ryan Chandler
b254e59bde
parser+lexer: support match expressions
Closes #16.
2022-08-04 00:21:10 +01:00
Ryan Chandler
38bf05f9f7
lexer: produce doc comments 2022-08-02 00:14:24 +01:00
Ryan Chandler
83aee4d171
phpc: compile conditionals, assignments and native fns 2022-08-01 14:13:53 +01:00
Ryan Chandler
212a46b2ac
lexer: produce increment tokens 2022-07-28 20:18:08 +01:00
Ryan Chandler
0322e3c805
parser: support normal for statements 2022-07-28 20:13:08 +01:00
Ryan Chandler
22d8cc332c
parser: support add assign operator 2022-07-28 20:07:40 +01:00
Ryan Chandler
67a26ae78f
parser: support clone expressions 2022-07-28 20:05:04 +01:00
Ryan Chandler
ad4f005511
parser: support null coalescing operator expressions (kinda) 2022-07-28 20:02:11 +01:00
Ryan Chandler
8f5a00b16d
lexer: fix fq identifiers and boolean or token 2022-07-28 17:53:05 +01:00
Ryan Chandler
d903fc5d79
parser&lexer: support for various things found in a Laravel app 2022-07-28 17:38:09 +01:00