-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix SourceSpan and History not being properly exported
Some modules where not being exported properly. This commit fixes the exports while at the same time orginizing some elements in the source code.
- Loading branch information
Showing
21 changed files
with
200 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
*/ | ||
|
||
/** | ||
* @module SourceReader/SourcePositions | ||
* @module SourceReader | ||
* @author Alan Rodas Bonjour <[email protected]> | ||
*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* @author Alan Rodas Bonjour <[email protected]> | ||
*/ | ||
|
||
import { SourcePosition } from './SourcePosition'; | ||
import { SourcePosition } from '../SourcePosition'; | ||
|
||
/** | ||
* This is the abstract implementation of the interface {@link SourcePosition}, and | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,8 @@ | |
* @author Alan Rodas Bonjour <[email protected]> | ||
*/ | ||
import { AbstractDocumentSourcePosition } from './AbstractDocumentSourcePosition'; | ||
import { SourcePosition } from './SourcePosition'; | ||
|
||
import { SourcePosition } from '../SourcePosition'; | ||
import { SourceReader } from '../SourceReader'; | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +10,15 @@ | |
* You may read the full license at https://gobstones.github.io/gobstones-guidelines/LICENSE. | ||
* ***************************************************************************** | ||
*/ | ||
|
||
/** | ||
* This module exposes the source position elements that are used by the | ||
* {@link SourceReader}. This module is internal, thus, the user should not | ||
* instantiate the classes here but through the {@link SourcePositions} factory. | ||
* {@link SourceReader}, that can be created and accessed through the | ||
* SourcePositionsFactory. | ||
* | ||
* @module SourceReader/SourcePositions | ||
* @author Alan Rodas Bonjour <[email protected]> | ||
* | ||
* @internal | ||
*/ | ||
export * from './SourceSpan'; | ||
export * from './SourcePosition'; | ||
export * from './SourcePositions'; | ||
export * from './SourcePositionFactory'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,8 @@ | |
* @module SourceReader | ||
* @author Pablo E. --Fidel-- Martínez López, <[email protected]> | ||
*/ | ||
import { SourcePosition, SourcePositions } from './SourcePositions'; | ||
import { SourcePosition } from './SourcePosition'; | ||
import { SourcePositionFactory } from './SourcePositions'; | ||
import { InvalidOperationAtEODError, InvalidOperationAtEOIError, NoInputError } from './SourceReaderErrors'; | ||
|
||
import { and, expect } from '../Expectations'; | ||
|
@@ -80,13 +81,13 @@ export type SourceInput = string | Record<string, string> | string[]; | |
* parts with ease. | ||
* | ||
* A {@link SourceReader} is created using a {@link SourceInput} and then | ||
* {@link SourceReader/SourcePositions.SourcePosition}s can be read from it. | ||
* {@link SourcePosition}s can be read from it. | ||
* Possible interactions with a {@link SourceReader} include: | ||
* - peek a character, with {@link SourceReader.peek | peek}, | ||
* - check if a given strings occurs at the beginning of the text in the | ||
* current document, without skipping it, with | ||
* {@link SourceReader.startsWith | startsWith}, | ||
* - get the current position as a {@link SourceReader/SourcePositions.SourcePosition}, with | ||
* - get the current position as a {@link SourcePosition}, with | ||
* {@link SourceReader.getPosition | getPosition}, | ||
* - detect if the end of input was reached, with | ||
* {@link SourceReader.atEndOfInput | atEndOfInput}, | ||
|
@@ -254,7 +255,7 @@ export type SourceInput = string | Record<string, string> | string[]; | |
* that have been processed as visible; unprocessed characters do not appear | ||
* (yet) on visible inputs. | ||
* | ||
* This class is tightly coupled with {@link SourceReader/SourcePositions.SourcePosition}'s implementations, | ||
* This class is tightly coupled with {@link SourcePosition}'s implementations, | ||
* because of instances of that class represent different positions in the source | ||
* inputs kept by a {@link SourceReader}. | ||
* The operations | ||
|
@@ -264,7 +265,7 @@ export type SourceInput = string | Record<string, string> | string[]; | |
* {@link SourceReader._inputFromToIn | _inputFromToIn}, | ||
* {@link SourceReader._documentContextBeforeOf | _fullInputFromTo} and | ||
* {@link SourceReader._documentContextAfterOf | _fullDocumentContentsAt} | ||
* are meant to be used only by {@link SourceReader/SourcePositions.SourcePosition}, to complete | ||
* are meant to be used only by {@link SourcePosition}, to complete | ||
* their operations, and so they are grouped as Protected. | ||
* | ||
* The remaining auxiliary operations are meant for internal usage, to | ||
|
@@ -283,7 +284,7 @@ export class SourceReader { | |
* | ||
* @group Properties (Static) | ||
*/ | ||
public static readonly UnknownPosition: SourcePosition = SourcePositions.Unknown(); | ||
public static readonly UnknownPosition: SourcePosition = SourcePositionFactory.Unknown(); | ||
|
||
/** | ||
* The string to use as a name for unnamed input documents. | ||
|
@@ -554,7 +555,7 @@ export class SourceReader { | |
} | ||
|
||
/** | ||
* Gives the current position as a {@link SourceReader/SourcePositions.SourcePosition}. | ||
* Gives the current position as a {@link SourcePosition}. | ||
* See {@link SourceReader} documentation for an example. | ||
* | ||
* **NOTE:** | ||
|
@@ -566,9 +567,9 @@ export class SourceReader { | |
public getPosition(): SourcePosition { | ||
/* istanbul ignore next */ | ||
if (!this._hasMoreDocuments()) { | ||
return SourcePositions.EndOfInput(this); | ||
return SourcePositionFactory.EndOfInput(this); | ||
} else if (!this._hasMoreCharsAtCurrentDocument()) { | ||
return SourcePositions.EndOfDocument( | ||
return SourcePositionFactory.EndOfDocument( | ||
this, | ||
this._line, | ||
this._column, | ||
|
@@ -578,7 +579,7 @@ export class SourceReader { | |
this._visibleDocumentContents[this.documentsNames[this._documentIndex]].length | ||
); | ||
} else { | ||
return SourcePositions.Document( | ||
return SourcePositionFactory.Document( | ||
this, | ||
this._line, | ||
this._column, | ||
|
@@ -703,7 +704,7 @@ export class SourceReader { | |
// ----------------------------------------------- | ||
/** | ||
* Gives the name of the input document at the given index. | ||
* It is intended to be used only by {@linkSourceReader/SourcePositions.SourcePosition}s. | ||
* It is intended to be used only by {@link SourcePosition}s. | ||
* | ||
* **PRECONDITION:** | ||
* `index <= this._documentsNames.length` (not verified) | ||
|
@@ -721,7 +722,7 @@ export class SourceReader { | |
/** | ||
* Gives the contents of the input document at the given index, both visible | ||
* and non-visible. | ||
* It is intended to be used only by {@link SourceReader/SourcePositions.SourcePosition}s. | ||
* It is intended to be used only by {@link SourcePosition}s. | ||
* | ||
* **PRECONDITION:** | ||
* `index < this._documentsNames.length` (not verified) | ||
|
@@ -738,7 +739,7 @@ export class SourceReader { | |
|
||
/** | ||
* Gives the contents of the visible input document at the given index. It | ||
* is intended to be used only by {@link SourceReader/SourcePositions.SourcePosition}s. | ||
* is intended to be used only by {@link SourcePosition}s. | ||
* | ||
* **PRECONDITION:** | ||
* `index < this._documentsNames.length` (not verified). | ||
|
@@ -974,7 +975,7 @@ export class SourceReader { | |
/** | ||
* Gives a clone of the stack of regions. | ||
* Auxiliary for {@link SourceReader/SourcePositions.SourceReader.getPosition | getPosition}. | ||
* It is necessary because regions of {@link SourceReader/SourcePositions.SourcePosition} must correspond | ||
* It is necessary because regions of {@link SourcePosition} must correspond | ||
* to those at that position and do not change with changes in reader state. | ||
* | ||
* @group Function: Auxiliaries | ||
|
Oops, something went wrong.