Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lexer] Refactor Tokens definitions.
- Loading branch information
1 parent
ff0894c
commit 6e824c3
Showing
8 changed files
with
148 additions
and
116 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import * as marked from 'marked'; | ||
import {TokensList} from '../shared/token'; | ||
|
||
|
||
export default class Lexer { | ||
|
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export default class TokenTypes { | ||
SPACE = 'space'; | ||
CODE = 'code'; | ||
HEADING = 'heading'; | ||
TABLE = 'table'; | ||
HR = 'hr'; | ||
BLOCKQUOTE_START = 'blockquote_start'; | ||
BLOCKQUOTE_END = 'blockquote_end'; | ||
LIST_START = 'list_start'; | ||
LOOSE_ITEM_START = 'loose_item_start'; | ||
LIST_ITEM_START = 'list_item_start'; | ||
LIST_ITEM_END = 'list_item_end'; | ||
LIST_END = 'list_end'; | ||
PARAGRAPH = 'paragraph'; | ||
HTML = 'html'; | ||
TEXT = 'text'; | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
|
||
export interface Space { | ||
type: 'space'; | ||
} | ||
|
||
export interface Code { | ||
type: 'code'; | ||
lang?: string; | ||
text: string; | ||
} | ||
|
||
export interface Heading { | ||
type: 'heading'; | ||
depth: number; | ||
text: string; | ||
} | ||
|
||
export interface Table { | ||
type: 'table'; | ||
header: string[]; | ||
align: Array<'center' | 'left' | 'right' | null>; | ||
cells: string[][]; | ||
} | ||
|
||
export interface Hr { | ||
type: 'hr'; | ||
} | ||
|
||
export interface BlockquoteStart { | ||
type: 'blockquote_start'; | ||
} | ||
|
||
export interface BlockquoteEnd { | ||
type: 'blockquote_end'; | ||
} | ||
|
||
export interface ListStart { | ||
type: 'list_start'; | ||
ordered: boolean; | ||
} | ||
|
||
export interface LooseItemStart { | ||
type: 'loose_item_start'; | ||
} | ||
|
||
export interface ListItemStart { | ||
type: 'list_item_start'; | ||
} | ||
|
||
export interface ListItemEnd { | ||
type: 'list_item_end'; | ||
} | ||
|
||
export interface ListEnd { | ||
type: 'list_end'; | ||
} | ||
|
||
export interface Paragraph { | ||
type: 'paragraph'; | ||
pre?: boolean; | ||
text: string; | ||
} | ||
|
||
export interface HTML { | ||
type: 'html'; | ||
pre: boolean; | ||
text: string; | ||
} | ||
|
||
export interface Text { | ||
type: 'text'; | ||
text: string; | ||
} | ||
|
||
|
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