How to use the luaparse.tokenTypes function in luaparse

To help you get started, we’ve selected a few luaparse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ark120202 / babel-lua / packages / lua-types / src / index.js View on Github external
export const isMemberExpression = node => node.type === 'MemberExpression';
export const isIndexExpression = node => node.type === 'IndexExpression';
export const isCallExpression = node => node.type === 'CallExpression';
export const isTableCallExpression = node => node.type === 'TableCallExpression';
export const isStringCallExpression = node => node.type === 'StringCallExpression';
export const isComment = node => node.type === 'Comment';

export const isLuaRaw = node => node.type === 'LuaRaw';

export const isBinary = node => isLogicalExpression(node) || isBinaryExpression(node);
export const isConditional = node => isIfClause(node) || isElseifClause(node);

export const tokenTypes = {
  EOF: luaparse.tokenTypes.EOF,
  StringLiteral: luaparse.tokenTypes.StringLiteral,
  Keyword: luaparse.tokenTypes.Keyword,
  Identifier: luaparse.tokenTypes.Identifier,
  NumericLiteral: luaparse.tokenTypes.NumericLiteral,
  Punctuator: luaparse.tokenTypes.Punctuator,
  BooleanLiteral: luaparse.tokenTypes.BooleanLiteral,
  NilLiteral: luaparse.tokenTypes.NilLiteral,
  VarargLiteral: luaparse.tokenTypes.VarargLiteral,
};

export const {
  labelStatement,
  breakStatement,
  gotoStatement,
  returnStatement,
  ifStatement,
  ifClause,
  elseifClause,
github ark120202 / babel-lua / packages / lua-types / src / index.js View on Github external
export const isBinaryExpression = node => node.type === 'BinaryExpression';
export const isUnaryExpression = node => node.type === 'UnaryExpression';
export const isMemberExpression = node => node.type === 'MemberExpression';
export const isIndexExpression = node => node.type === 'IndexExpression';
export const isCallExpression = node => node.type === 'CallExpression';
export const isTableCallExpression = node => node.type === 'TableCallExpression';
export const isStringCallExpression = node => node.type === 'StringCallExpression';
export const isComment = node => node.type === 'Comment';

export const isLuaRaw = node => node.type === 'LuaRaw';

export const isBinary = node => isLogicalExpression(node) || isBinaryExpression(node);
export const isConditional = node => isIfClause(node) || isElseifClause(node);

export const tokenTypes = {
  EOF: luaparse.tokenTypes.EOF,
  StringLiteral: luaparse.tokenTypes.StringLiteral,
  Keyword: luaparse.tokenTypes.Keyword,
  Identifier: luaparse.tokenTypes.Identifier,
  NumericLiteral: luaparse.tokenTypes.NumericLiteral,
  Punctuator: luaparse.tokenTypes.Punctuator,
  BooleanLiteral: luaparse.tokenTypes.BooleanLiteral,
  NilLiteral: luaparse.tokenTypes.NilLiteral,
  VarargLiteral: luaparse.tokenTypes.VarargLiteral,
};

export const {
  labelStatement,
  breakStatement,
  gotoStatement,
  returnStatement,
  ifStatement,

luaparse

A Lua parser in JavaScript

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis