@yannosay/sinth 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/sinth.ts +3 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yannosay/sinth",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "A declarative language that compiles to pure HTML, CSS, and JavaScript.",
5
5
  "author": "Yannosay Productions",
6
6
  "license": "AGPL-3.0",
package/src/sinth.ts CHANGED
@@ -802,7 +802,9 @@ export class Parser {
802
802
  this.consume(TT.LPAREN);
803
803
  while (!this.check(TT.RPAREN)) {
804
804
  const ploc = this.peek().loc;
805
- const pname = this.consume(TT.IDENT).value;
805
+ // allow keywords as parameter names (e.g., "for" in custom-element declarations)
806
+ const nameTok = this.check(TT.IDENT) ? this.consume(TT.IDENT) : this.consume(this.peek().type);
807
+ const pname = nameTok.value;
806
808
  let defaultVal: Literal | undefined;
807
809
  if (this.check(TT.EQUALS)) { this.consume(TT.EQUALS); defaultVal = this.parseLiteral(); }
808
810
  params.push({ name: pname, defaultVal, loc: ploc });