prettier-plugin-glsl
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -76,2 +76,3 @@ import { ILexingResult, IToken, Lexer, TokenType } from "chevrotain"; | ||
const EXTENSION: TokenType; | ||
const INCLUDE: TokenType; | ||
const HASH: TokenType; | ||
@@ -156,2 +157,3 @@ const KEYWORD: TokenType; | ||
const INTCONSTANT: TokenType; | ||
const STRING: TokenType; | ||
} | ||
@@ -158,0 +160,0 @@ export declare const ALL_TOKENS: any[]; |
@@ -275,3 +275,7 @@ import { IToken } from "chevrotain"; | ||
} | ||
export type PpNode = PpDefine | PpDir | PpExtension | PpCall | PpPragma; | ||
export interface PpInclude extends BaseNode { | ||
kind: "ppInclude"; | ||
what: Token; | ||
} | ||
export type PpNode = PpDefine | PpDir | PpExtension | PpCall | PpPragma | PpInclude; | ||
export type Declaration = FunctionDefinition | FunctionPrototype | InitDeclaratorListDeclaration | PrecisionDeclaration | InvariantDeclaration | TypeQualifierDeclaration | UniformBlock | PpNode; | ||
@@ -278,0 +282,0 @@ export type JumpStatement = ReturnStatement | ContinueStatement | BreakStatement | DiscardStatement; |
import { EmbeddedActionsParser, IRecognitionException, IRuleConfig, IToken, TokenType } from "chevrotain"; | ||
import { ArraySpecifier, CaseBlock, CaseLabel, CompoundStatement, Declaration, Expression, ExpressionStatement, FullySpecifiedType, FunctionCall, InitDeclaratorListDeclaration, IterationStatement, JumpStatement, LayoutQualifier, Node, ParameterDeclaration, PpCall, PpDefine, PpDir, PpExtension, PpNode, PpPragma, SelectionStatement, Statement, StorageQualifier, StructDeclaration, StructSpecifier, SwitchStatement, Token, TranslationUnit, TypeQualifier, TypeQualifierDeclaration, TypeSpecifier, UniformBlock } from "./nodes"; | ||
import { ArraySpecifier, CaseBlock, CaseLabel, CompoundStatement, Declaration, Expression, ExpressionStatement, FullySpecifiedType, FunctionCall, InitDeclaratorListDeclaration, IterationStatement, JumpStatement, LayoutQualifier, Node, ParameterDeclaration, PpCall, PpDefine, PpDir, PpExtension, PpInclude, PpNode, PpPragma, SelectionStatement, Statement, StorageQualifier, StructDeclaration, StructSpecifier, SwitchStatement, Token, TranslationUnit, TypeQualifier, TypeQualifierDeclaration, TypeSpecifier, UniformBlock } from "./nodes"; | ||
declare class GLSLParser extends EmbeddedActionsParser { | ||
@@ -58,2 +58,3 @@ multiplicativeExpression: () => Expression; | ||
ppDefine: () => PpDefine; | ||
ppInclude: () => PpInclude; | ||
ppCall: () => PpCall; | ||
@@ -60,0 +61,0 @@ ppCallArg: import("chevrotain").ParserMethod<[], Token[]>; |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Prettier (https://prettier.io) plugin for GLSL (OpenGL Shading Language).", | ||
@@ -45,21 +45,21 @@ "exports": "./lib/prettier-plugin.cjs.js", | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^10.0.1", | ||
"@rollup/plugin-typescript": "^11.0.0", | ||
"@types/dedent": "^0.7.0", | ||
"@types/jest": "^29.2.3", | ||
"@types/jest": "^29.4.0", | ||
"@types/lodash": "^4.14.191", | ||
"@types/node": "^18.11.10", | ||
"@types/node": "^18.14.2", | ||
"@types/node-fetch": "^2.6.2", | ||
"@types/prettier": "^2.7.1", | ||
"@typescript-eslint/eslint-plugin": "^5.45.0", | ||
"@typescript-eslint/parser": "^5.45.0", | ||
"eslint": "^8.28.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"@types/prettier": "^2.7.2", | ||
"@typescript-eslint/eslint-plugin": "^5.53.0", | ||
"@typescript-eslint/parser": "^5.53.0", | ||
"eslint": "^8.35.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"eslint-plugin-cflint": "^1.0.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"filesize": "^10.0.5", | ||
"jest": "^29.3.1", | ||
"eslint-plugin-import": "^2.27.5", | ||
"filesize": "^10.0.6", | ||
"jest": "^29.4.3", | ||
"node-fetch": "^3.3.0", | ||
"rollup": "^3.5.1", | ||
"rollup": "^3.17.3", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"ts-jest": "^29.0.3", | ||
"ts-jest": "^29.0.5", | ||
"ts-node-dev": "^2.0.0" | ||
@@ -66,0 +66,0 @@ }, |
@@ -466,2 +466,4 @@ // noinspection JSUnusedGlobalSymbols | ||
export const EXTENSION = createPP("EXTENSION", "extension") | ||
export const INCLUDE = createPP("INCLUDE", "include") | ||
export const HASH = createToken({ name: "HASH", pattern: "#" }) | ||
@@ -607,2 +609,8 @@ | ||
}) | ||
// Only used in the context of #include. | ||
export const STRING = createToken({ | ||
name: "STRING", | ||
pattern: /"([^"\\]+|\\")+"/, | ||
}) | ||
} | ||
@@ -609,0 +617,0 @@ // IDENTIFIER needs to go last, but must be declared first |
@@ -365,4 +365,15 @@ import { IToken } from "chevrotain" | ||
export type PpNode = PpDefine | PpDir | PpExtension | PpCall | PpPragma | ||
export interface PpInclude extends BaseNode { | ||
kind: "ppInclude" | ||
what: Token | ||
} | ||
export type PpNode = | ||
| PpDefine | ||
| PpDir | ||
| PpExtension | ||
| PpCall | ||
| PpPragma | ||
| PpInclude | ||
export type Declaration = | ||
@@ -369,0 +380,0 @@ | FunctionDefinition |
@@ -40,2 +40,3 @@ /* eslint-disable @typescript-eslint/member-ordering */ | ||
PpExtension, | ||
PpInclude, | ||
PpNode, | ||
@@ -1447,2 +1448,9 @@ PpPragma, | ||
public ppInclude = this.RR("ppInclude", (): PpInclude => { | ||
this.CONSUME(TOKEN.HASH) | ||
this.CONSUME(TOKEN.INCLUDE) | ||
const str = this.CONSUME(TOKEN.STRING) | ||
return { kind: "ppInclude", what: str } | ||
}) | ||
public ppCall = this.RR("ppCall", (): PpCall => { | ||
@@ -1566,2 +1574,3 @@ const callee = this.CONSUME(TOKEN.IDENTIFIER) | ||
{ ALT: () => this.SUBRULE(this.ppPragma) }, | ||
{ ALT: () => this.SUBRULE(this.ppInclude) }, | ||
]), | ||
@@ -1568,0 +1577,0 @@ ) |
@@ -1058,2 +1058,4 @@ // noinspection JSUnusedGlobalSymbols | ||
} | ||
case "ppInclude": | ||
return ["#include ", n.what.image] | ||
case "switchStatement": { | ||
@@ -1060,0 +1062,0 @@ return [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
541494
11881