Skip to content

@page and @left-middle crashes the parser #210

@edi9999

Description

@edi9999

Expected Behaviour

@page {
    @left-middle {
        margin: 0;
    }
}

should parse without an error

Actual Behaviour

It throws the following :

input.css:29:5: @page missing '}'

  77 |
  78 |   function error(msg: string) {
> 79 |     const err = new CssParseError(
     |                 ^
  80 |       options?.source || '',
  81 |       msg,
  82 |       lineno,

  at error (src/parse/index.ts:79:17)
  at atpage (src/parse/index.ts:562:14)
  at atrule (src/parse/index.ts:693:7)
  at rules (src/parse/index.ts:134:59)
  at stylesheet (src/parse/index.ts:98:23)
  at parse (src/parse/index.ts:720:20)
  at parseInput (test/cases.test.ts:39:19)
  at Object.<anonymous> (test/cases.test.ts:31:36)

Reproduce Scenario (including but not limited to)

Apply following git patch :

diff --git a/test/cases/media/input.css b/test/cases/media/input.css
index 8ab3a73..fa567e0 100644
--- a/test/cases/media/input.css
+++ b/test/cases/media/input.css
@@ -24,3 +24,9 @@
     border: 0.5pt solid #666;
   }
 }
+
+@page {
+    @left-middle {
+        margin: 0;
+    }
+}

Steps to Reproduce

Run npm test in the css-tools repository

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions