Update php.ts #3

Closed
WinterSilence wants to merge 2 commits from patch-1 into main
WinterSilence commented 2021-12-19 21:52:24 +01:00 (Migrated from github.com)

Add magic constants
Add self keywords
Extend list of keywords
Group variable types

Add [magic constants](https://www.php.net/manual/en/language.constants.magic.php) Add `self` keywords Extend [list of keywords](https://www.php.net/manual/en/reserved.keywords.php) Group variable types
WinterSilence commented 2021-12-19 21:56:47 +01:00 (Migrated from github.com)

Also need help with adding class constants

Also need help with adding class constants
marijnh commented 2021-12-20 07:54:54 +01:00 (Migrated from github.com)

Many of these don't seem to actually be emitted by the parser. Defining a highlighting tag for a name that won't appear in the parse tree doesn't actually work.

Many of these don't seem to actually be emitted by the parser. Defining a highlighting tag for a name that won't appear in the parse tree doesn't actually work.
WinterSilence commented 2021-12-20 10:03:16 +01:00 (Migrated from github.com)

@marijnh you mean many in this PR or at all?

@marijnh you mean many in this PR or at all?
marijnh commented 2021-12-20 10:08:44 +01:00 (Migrated from github.com)

In this PR.

In this PR.
WinterSilence commented 2021-12-20 10:19:17 +01:00 (Migrated from github.com)

@marijnh

Defining a highlighting tag for a name

I'm add only self keywords and magic constants, in other cases I'm only append missed keywords. please, specify exactly what's wrong?

@marijnh > Defining a highlighting tag for a name I'm add only `self` keywords and magic constants, in other cases I'm only append missed keywords. please, specify exactly what's wrong?
marijnh commented 2021-12-20 10:23:53 +01:00 (Migrated from github.com)

These changes don't work, for things like __CLASS__, as I'm sure you can confirm. The names in this context refer to syntax tree node names, so you can't just define new constants here.

These changes don't work, for things like `__CLASS__`, as I'm sure you can confirm. The names in this context refer to syntax tree node names, so you can't just define new constants here.
WinterSilence commented 2021-12-20 11:13:30 +01:00 (Migrated from github.com)

@marijnh ok, constants are removed. anything else?

@marijnh ok, constants are removed. anything else?
marijnh commented 2021-12-20 11:24:48 +01:00 (Migrated from github.com)

Attached patch adds the ones that were missed. The others don't exist in the parser output.

Attached patch adds the ones that were missed. The others don't exist in the parser output.
WinterSilence commented 2021-12-20 11:28:41 +01:00 (Migrated from github.com)

@marijnh why declare enddeclare not in control keywords? why eval isset empty die exit __halt_compiler don't exist in the parser output?

@marijnh why `declare enddeclare` not in control keywords? why `eval isset empty die exit __halt_compiler` don't exist in the parser output?
marijnh commented 2021-12-20 11:32:45 +01:00 (Migrated from github.com)

@marijnh why declare enddeclare not in control keywords?

Oh, I see, they were already there in definition keywords, which seems a reasonable place for them as well. My patch actually adds them to control keywords.

why eval isset empty die exit __halt_compiler don't exist in the parser output?

Mostly because they didn't appear in the tree-sitter grammar our grammar is based on, which I guess is because you still get a reasonable parse even if you don't handle these specially.

> @marijnh why declare enddeclare not in control keywords? Oh, I see, they were already there in definition keywords, which seems a reasonable place for them as well. My patch actually adds them to control keywords. > why eval isset empty die exit __halt_compiler don't exist in the parser output? Mostly because they didn't appear in the tree-sitter grammar our grammar is based on, which I guess is because you still get a reasonable parse even if you don't handle these specially.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/lang-php!3
No description provided.