Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #4242 - @layer feature #4260

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
150 changes: 113 additions & 37 deletions packages/less/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/less/package.json
Expand Up @@ -96,7 +96,7 @@
"resolve": "^1.17.0",
"rollup": "^2.52.2",
"rollup-plugin-terser": "^5.1.1",
"rollup-plugin-typescript2": "^0.29.0",
"rollup-plugin-typescript2": "^0.36.0",
"semver": "^6.3.0",
"shx": "^0.3.2",
"time-grunt": "^1.3.0",
Expand Down Expand Up @@ -134,7 +134,7 @@
"dependencies": {
"copy-anything": "^2.0.1",
"parse-node-version": "^1.0.1",
"tslib": "^2.3.0"
"tslib": "^2.6.2"
},
"gitHead": "1df9072ee9ebdadc791bf35dfb1dbc3ef9f1948f"
}
65 changes: 49 additions & 16 deletions packages/less/src/less/parser/parser-input.js
@@ -1,31 +1,64 @@
import chunker from './chunker';

export default () => {
let // Less input string
input;
// Less input string
let input;

let // current chunk
j;
// current chunk
let j;

const // holds state for backtracking
saveStack = [];
// holds state for backtracking
const saveStack = [];

let // furthest index the parser has gone to
furthest;
// furthest index the parser has gone to
let furthest;

let // if this is furthest we got to, this is the probably cause
furthestPossibleErrorMessage;
// if this is furthest we got to, this is the probably cause
let furthestPossibleErrorMessage;

let // chunkified input
chunks;
// chunkified input
let chunks;

let // current chunk
current;
// current chunk
let current;

let // index of current chunk, in `input`
currentPos;
// index of current chunk, in `input`
let currentPos;

/**
* @type {{
* i: number
* save(): void
* restore(possibleErrorMessage?: string): void
* forget(): void
* isWhitespace(offset?: number): boolean
* $re(tok: RegExp): string | null
* $char(tok: string): string | null
* $peekChar(tok: string): string | null
* $str(tok: string): string | null
* $quoted(loc?: number): string | [string, string]
* $parseUntil(tok: string | RegExp): string | string[] | null
* autoCommentAbsorb: boolean
* commentStore: {index: number, text: string, isLineComment: boolean}[]
* finished: boolean
* peek(tok: string | RegExp): boolean
* peekChar(tok: string): boolean
* currentChar(): string
* prevChar(): string
* getInput(): string
* peekNotNumeric(): boolean
* start(str: string, chunkInput: boolean, failFunction: (message: string, index?: number) => void): void
* end(): {
* isFinished: boolean
* furthest: number
* furthestPossibleErrorMessage: string
* furthestReachedEnd: boolean
* furthestChar: string
* }
* }}
*/
const parserInput = {};

const CHARCODE_SPACE = 32;
const CHARCODE_TAB = 9;
const CHARCODE_LF = 10;
Expand Down