4.13.4 • Published 2 months ago

scalameta-parsers v4.13.4

Weekly downloads
83
License
BSD-3-Clause
Repository
github
Last release
2 months ago

scalameta-parsers

A JS API for the parsers module of scalameta.

It exposes two functions:

  • parseSource(code: string): parses the given code as a full-fledged source file

  • parseStat(code: string): parses the given code a statement (useful for parsing single expressions without wrapping them into an object or class)

Example:

const { parseStat, parseSource } = require('scalameta-parsers');

const tree1 = parseStat('val answer = 42');
console.log(tree1);

// Output:

// { type: 'Defn.Val',
//   children:
//    [ { type: 'Pat.Var.Term', children: [Object], pos: [Object] },
//      { type: 'Lit.Int', children: [], pos: [Object], value: 42 } ],
//   pos: { start: 0, end: 15 } }

const tree2 = parseSource(`
object Main {
  def main(args: Array[String]): Unit =
    println("Hello, World!")
}`);
console.log(tree2);

// Output:

// { type: 'Source',
//   children: [ { type: 'Defn.Object', children: [Object], pos: [Object] } ],
//   pos: { start: 0, end: 85 } }
4.12.7

4 months ago

4.12.3

5 months ago

4.12.4

4 months ago

4.12.5

4 months ago

4.12.6

4 months ago

4.12.0

6 months ago

4.12.1

5 months ago

4.12.2

5 months ago

4.13.2

3 months ago

4.13.3

2 months ago

4.13.4

2 months ago

4.11.1

6 months ago

4.13.0

3 months ago

4.11.2

6 months ago

4.13.1

3 months ago

4.11.0

7 months ago

4.10.1

8 months ago

4.10.2

7 months ago

4.10.0

8 months ago

4.9.8

10 months ago

4.9.7

11 months ago

4.9.9

10 months ago

4.9.6

11 months ago

4.9.5

12 months ago

4.9.4

12 months ago

4.9.3

1 year ago

4.9.2

1 year ago

4.9.1

1 year ago

4.9.1-RC1

1 year ago

4.9.0

1 year ago

4.8.15

1 year ago

4.8.12

2 years ago

4.8.14

1 year ago

4.8.13

2 years ago

4.8.11

2 years ago

4.8.9

2 years ago

4.8.8

2 years ago

4.8.5

2 years ago

4.8.4

2 years ago

4.8.7

2 years ago

4.7.8

2 years ago

4.8.6

2 years ago

4.8.1

2 years ago

4.8.0

2 years ago

4.8.3

2 years ago

4.8.2

2 years ago

4.8.10

2 years ago

4.7.6

2 years ago

4.7.5

2 years ago

4.7.7

2 years ago

4.7.2

2 years ago

4.7.4

2 years ago

4.7.3

2 years ago

4.7.1

2 years ago

4.7.0

2 years ago

4.4.1-7.beta0

4 years ago

4.4.17

4 years ago

4.2.1

6 years ago

4.2.0

6 years ago

2.0.1

8 years ago

2.0.0-RC3

8 years ago

1.9.0-beta.3

8 years ago

1.9.0-beta.2

8 years ago

1.9.0-beta.1

8 years ago

1.9.0-beta

8 years ago

1.8.0

8 years ago