Skip to content

from and revert are highlighted as keywords in Solidity code everywhere #3980

@FezVrasta

Description

@FezVrasta

Information:

  • Prism version: 1.30.0
  • Plugins: none
  • Environment: browser

Description

from should only be highlighted as a keyword in Solidity when used in import statements.
revert should only be highlighted as a keyword in Solidity when used in revert statements.

test case:

function f(address from) virtual  {}
function g(bool revert) virtual {}

Note that there is this rule in Solidity's grammar:

https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.identifier

/**
 * Besides regular non-keyword Identifiers, some keywords like 'from' and 'error' can also be used as identifiers.
 */
identifier: Identifier | From | Error | Revert | Global | Transient | Layout | At;

docs/grammar/SolidityParser.g4#L425-L428

Example
https://prismjs.com/test#language=solidity&text=function%20f(address%20from)%20virtual%20%20%7B%7D%0Afunction%20g(bool%20revert)%20virtual%20%7B%7D

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions