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

Make ESM compatible #175

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
6 changes: 3 additions & 3 deletions src/lib/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* Licensed under the LGPL2 license.
*/

import option from './option';
import atry from './try';
import unit from './unit';
import option from './option.js';
import atry from './try.js';
import unit from './unit.js';

export default {
option,
Expand Down
8 changes: 4 additions & 4 deletions src/lib/genlex/genlex.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import response from "../parsec/response";
import {F, C, N} from "../parsec";
import unit from "../data/unit";
import option from "../data/option";
import response from "../parsec/response.js";
import {F, C, N} from "../parsec/index.js";
import unit from "../data/unit.js";
import option from "../data/option.js";


export class TokenDefinition {
Expand Down
18 changes: 9 additions & 9 deletions src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
* Licensed under the LGPL2 license.
*/

import data from './data/index';
import {GenLex,getMathGenLex} from './genlex/genlex';
import parsec from './parsec/index';
import Parser from './parsec/parser';
import {F, C, N} from './parsec/index';
import standard from './standard/index';
import Streams from './stream/index';
import data from './data/index.js';
import {GenLex,getMathGenLex} from './genlex/genlex.js';
import parsec from './parsec/index.js';
import Parser from './parsec/parser.js';
import {F, C, N} from './parsec/index.js';
import standard from './standard/index.js';
import Streams from './stream/index.js';

import {accept, reject} from "./parsec/response";
import {Tuple, isTuple, NEUTRAL, tuple} from "./data/tuple";
import {accept, reject} from "./parsec/response.js";
import {Tuple, isTuple, NEUTRAL, tuple} from "./data/tuple.js";


const JSON = standard.jsonParser;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/parsec/chars-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* Copyright (c) 2016 Didier Plaindoux
* Licensed under the LGPL2 license.
*/
import F from './flow-bundle';
import {string} from './flow-bundle';
import F from './flow-bundle.js';
import {string} from './flow-bundle.js';

const ASCII_LETTER = Symbol('ASCII');
const OCCIDENTAL_LETTER = Symbol('OCCIDENTAL');
Expand Down
6 changes: 3 additions & 3 deletions src/lib/parsec/flow-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* Licensed under the LGPL2 license.
*/

import Parser, {eos} from './parser';
import response from './response';
import {NEUTRAL, Tuple} from "../data/tuple";
import Parser, {eos} from './parser.js';
import response from './response.js';
import {NEUTRAL, Tuple} from "../data/tuple.js";

// (Stream 'c -> number -> Response 'a 'c) -> Parser 'a 'c
function parse(p) {
Expand Down
10 changes: 5 additions & 5 deletions src/lib/parsec/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* Licensed under the LGPL2 license.
*/

import parser from './parser';
import response from './response';
import flow from './flow-bundle';
import chars from './chars-bundle';
import numbers from './numbers-bundle';
import parser from './parser.js';
import response from './response.js';
import flow from './flow-bundle.js';
import chars from './chars-bundle.js';
import numbers from './numbers-bundle.js';

export const C = chars;
export const F = flow;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/parsec/numbers-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Licensed under the LGPL2 license.
*/

import C from './chars-bundle';
import F from './flow-bundle';
import C from './chars-bundle.js';
import F from './flow-bundle.js';

// unit -> Parser number char
function number() {
Expand Down
10 changes: 5 additions & 5 deletions src/lib/parsec/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
* http://research.microsoft.com/en-us/um/people/daan/download/papers/parsec-paper.pdf
*/

import stream from '../stream/index';
import stream from '../stream/index.js';

import option from '../data/option';
import option from '../data/option.js';


import response from './response';
import unit from "../data/unit";
import {NEUTRAL, Tuple, isTuple} from "../data/tuple";
import response from './response.js';
import unit from "../data/unit.js";
import {NEUTRAL, Tuple, isTuple} from "../data/tuple.js";


/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/standard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Licensed under the LGPL2 license.
*/

import jsonParser from './json/jsonparser';
import jsonParser from './json/jsonparser.js';

export default {
jsonParser
Expand Down
6 changes: 3 additions & 3 deletions src/lib/standard/json/jsonparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* Licensed under the LGPL2 license.
*/

import {GenLex} from '../../genlex/genlex';
import {GenLex} from '../../genlex/genlex.js';

import {F,C,N} from '../../parsec/index.js';

import {F} from '../../parsec/index';
import {C, N} from "../../parsec";

//
// Facilities
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stream/arraystream.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (c) 2016 Didier Plaindoux
* Licensed under the LGPL2 license.
*/
import Stream from './stream';
import Stream from './stream.js';

/**
* Array stream class
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stream/bufferedstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (c) 2016 Didier Plaindoux
* Licensed under the LGPL2 license.
*/
import Stream from './stream';
import Stream from './stream.js';

/**
* Buffered stream class
Expand Down
8 changes: 4 additions & 4 deletions src/lib/stream/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* Licensed under the LGPL2 license.
*/

import stringStreamFactory from './stringstream';
import arrayStreamFactory from './arraystream';
import parserStreamFactory from './parserstream';
import bufferedStreamFactory from './bufferedstream';
import stringStreamFactory from './stringstream.js';
import arrayStreamFactory from './arraystream.js';
import parserStreamFactory from './parserstream.js';
import bufferedStreamFactory from './bufferedstream.js';

export default {
ofString: stringStreamFactory,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/stream/parserstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Licensed under the LGPL2 license.
*/

import Stream from './stream';
import option from '../data/option';
import Stream from './stream.js';
import option from '../data/option.js';

/**
* ParserStream stream class
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stream/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Licensed under the LGPL2 license.
*/

import atry from '../data/try';
import atry from '../data/try.js';

/**
* Abstract methods:
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stream/stringstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (c) 2016 Didier Plaindoux
* Licensed under the LGPL2 license.
*/
import Stream from './stream';
import Stream from './stream.js';

/**
* String stream class
Expand Down