Skip to content

Allow Colon : in HTML Attribute Names#496

Merged
marcoroth merged 1 commit intomainfrom
colon-in-attribute-name
Sep 13, 2025
Merged

Allow Colon : in HTML Attribute Names#496
marcoroth merged 1 commit intomainfrom
colon-in-attribute-name

Conversation

@marcoroth
Copy link
Owner

@marcoroth marcoroth commented Sep 13, 2025

This pull request updates the parser to allow HTML Attributes to start with a colon, which is typical in the Vue.js style:

<div :class="classes"></div>

Previously, this caused a syntax error:

@ UnexpectedError (location: (1:5)-(1:6))
├── message: "Unexpected Token. Expected: `TOKEN_IDENTIFIER, TOKEN_AT, TOKEN_ERB_START,TOKEN_WHITESPACE, or TOKEN_NEWLINE`, found: `TOKEN_COLON`."
├── description: "Unexpected Token"
├── expected: "TOKEN_IDENTIFIER, TOKEN_AT, TOKEN_ERB_START,TOKEN_WHITESPACE, or TOKEN_NEWLINE"
└── found: "TOKEN_COLON"

Now this parses as:

@ HTMLAttributeNode (location: (1:5)-(1:21))
├── errors: []
├── name: 
   └── @ HTMLAttributeNameNode (location: (1:5)-(1:11))
       ├── errors: []└── children: (1 item)
           └── @ LiteralNode (location: (1:5)-(1:11))
               ├── errors: []└── content: ":class"
                      
├── equals: "=" (location: (1:11)-(1:12))
└── value: 
    └── @ HTMLAttributeValueNode (location: (1:12)-(1:21))
        ├── errors: []
        ├── open_quote: """ (location: (1:12)-(1:13))
        ├── children: (1 item)
           └── @ LiteralNode (location: (1:13)-(1:20))
               ├── errors: []└── content: "classes"
               
           
        ├── close_quote: """ (location: (1:20)-(1:21))
        └── quoted: true

@marcoroth marcoroth merged commit bd1a2eb into main Sep 13, 2025
18 checks passed
@marcoroth marcoroth deleted the colon-in-attribute-name branch September 13, 2025 16:25
@tvdeyen
Copy link

tvdeyen commented Sep 15, 2025

OMG Thanks! 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants