How to use scalameta-parsers - 2 common examples

To help you get started, we’ve selected a few scalameta-parsers 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 fkling / astexplorer / website / src / parsers / scala / scalameta.js View on Github external
'Dotty': 'Dotty',
  'Typelevel 2.11': 'Typelevel211',
  'Typelevel 2.12': 'Typelevel212',
  'Paradise 2.11': 'Paradise211',
  'Paradise 2.12': 'Paradise212',
  'Paradise Typelevel 2.11': 'ParadiseTypelevel211',
  'Paradise Typelevel 2.12': 'ParadiseTypelevel212',
};

export default {
  ...defaultParserInterface,

  id: ID,
  displayName: ID,
  version: pkg.version,
  homepage: pkg.homepage || 'https://github.com/scalameta/scalameta',
  locationProps: new Set(['pos']),

  loadParser(callback) {
    require(['scalameta-parsers'], callback);
  },

  parse(scalametaParser, code, options) {
    const parsed = scalametaParser.parseSource(code, options);
    const { error, lineNumber, columnNumber } = parsed;
    if (error) {
      const e = new SyntaxError(parsed.error);
      e.lineNumber = lineNumber + 1;
      e.columnNumber = columnNumber + 1;
      throw e;
    }
    return parsed;
github fkling / astexplorer / website / src / parsers / scala / scalameta.js View on Github external
'Sbt 1': 'Sbt 1',
  'Dotty': 'Dotty',
  'Typelevel 2.11': 'Typelevel211',
  'Typelevel 2.12': 'Typelevel212',
  'Paradise 2.11': 'Paradise211',
  'Paradise 2.12': 'Paradise212',
  'Paradise Typelevel 2.11': 'ParadiseTypelevel211',
  'Paradise Typelevel 2.12': 'ParadiseTypelevel212',
};

export default {
  ...defaultParserInterface,

  id: ID,
  displayName: ID,
  version: pkg.version,
  homepage: pkg.homepage || 'https://github.com/scalameta/scalameta',
  locationProps: new Set(['pos']),

  loadParser(callback) {
    require(['scalameta-parsers'], callback);
  },

  parse(scalametaParser, code, options) {
    const parsed = scalametaParser.parseSource(code, options);
    const { error, lineNumber, columnNumber } = parsed;
    if (error) {
      const e = new SyntaxError(parsed.error);
      e.lineNumber = lineNumber + 1;
      e.columnNumber = columnNumber + 1;
      throw e;
    }

scalameta-parsers

Library to parse Scala programs

BSD-3-Clause
Latest version published 3 days ago

Package Health Score

88 / 100
Full package analysis