mirror of
https://github.com/heyman/heynote.git
synced 2024-11-22 16:03:28 +01:00
Rename parser files
This commit is contained in:
parent
53d340060d
commit
79f4a7f0d7
@ -8,7 +8,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "rollup -c",
|
||||
"watch": "rollup -c -w",
|
||||
"build_grammar": "lezer-generator src/lang-heynote/heynote.grammar -o src/lang-heynote/heynote.js"
|
||||
"build_grammar": "lezer-generator src/lang-heynote/heynote.grammar -o src/lang-heynote/parser.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
@ -5,7 +5,7 @@ import {indentWithTab, insertTab, indentLess, indentMore} from "@codemirror/comm
|
||||
import {nord} from "./theme/nord.mjs"
|
||||
import initialData from "./fixture.js"
|
||||
import { customSetup } from "./setup.js"
|
||||
import { heynoteLang } from "./lang-heynote/parser.js"
|
||||
import { heynoteLang } from "./lang-heynote/heynote.js"
|
||||
import { noteBlockExtension } from "./note-block.js"
|
||||
import { heynoteEvent, INITIAL_DATA } from "./annotation.js"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ExternalTokenizer } from '@lezer/lr'
|
||||
import { NoteContent } from "./heynote.terms.js"
|
||||
import { NoteContent } from "./parser.terms.js"
|
||||
|
||||
const EOF = -1;
|
||||
|
||||
|
@ -1,17 +1,50 @@
|
||||
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
||||
import {LRParser} from "@lezer/lr"
|
||||
import {noteContent} from "./external-tokens.js"
|
||||
export const parser = LRParser.deserialize({
|
||||
version: 14,
|
||||
states: "!WQQOPOOOVOPO'#C`O[OQO'#C_OOOO'#Cb'#CbQQOPOOOaOPO,58zOOOO,58y,58yOOOO-E6`-E6`OOOQ1G.f1G.f",
|
||||
stateData: "f~OWPO~OTTO~OPUO~OXWO~O",
|
||||
goto: "fVPPPW[P`TROSTQOSQSORVS",
|
||||
nodeNames: "⚠ NoteContent Document Note NoteDelimiter NoteLanguage",
|
||||
maxTerm: 9,
|
||||
skippedNodes: [0],
|
||||
repeatNodeCount: 1,
|
||||
tokenData: "&e~RXYZn#[#]s#^#_![#`#a#u#a#b$_#d#e%T#g#h%p#h#i%v%&x%&y&S~sOX~~vP#h#iy~|P#a#b!P~!SP#`#a!V~![OT~~!_Q#T#U!e#g#h#i~!hP#j#k!k~!nP#T#U!q~!vPT~#g#h!y~!|P#V#W#P~#SP#f#g#V~#YP#]#^#]~#`P#d#e#c~#fP#h#i!V~#lP#c#d#o~#rP#b#c!V~#xP#X#Y#{~$OP#n#o$R~$UP#X#Y$X~$[P#f#g!V~$bP#T#U$e~$hP#f#g$k~$nP#_#`$q~$tP#W#X$w~$zP#c#d$}~%QP#k#l#o~%WQ#[#]%^#m#n%d~%aP#d#e!V~%gP#h#i%j~%mP#[#]#i~%sP#e#f!P~%yP#X#Y%|~&PP#l#m#c~&VP%&x%&y&Y~&]P%&x%&y&`~&eOW~",
|
||||
tokenizers: [0, noteContent],
|
||||
topRules: {"Document":[0,2]},
|
||||
tokenPrec: 0
|
||||
import { parser } from "./parser.js"
|
||||
import { configureNesting } from "./nested-parser.js";
|
||||
|
||||
import {LRLanguage, LanguageSupport, indentNodeProp, foldNodeProp, foldInside, delimitedIndent, codeFolding} from "@codemirror/language"
|
||||
import {styleTags, tags as t} from "@lezer/highlight"
|
||||
|
||||
import { json } from "@codemirror/lang-json"
|
||||
import { javascript } from "@codemirror/lang-javascript"
|
||||
|
||||
|
||||
function foldNode(node) {
|
||||
//console.log("foldNode", node);
|
||||
return {from:node.from, to:node.to-1};
|
||||
//let first = node.firstChild, last = node.lastChild;
|
||||
//return first && first.to < last.from ? { from: first.to, to: last.type.isError ? node.to : last.from } : null;
|
||||
}
|
||||
|
||||
export const HeynoteLanguage = LRLanguage.define({
|
||||
parser: parser.configure({
|
||||
props: [
|
||||
styleTags({
|
||||
NoteDelimiter: t.tagName,
|
||||
}),
|
||||
|
||||
foldNodeProp.add({
|
||||
//NoteContent: foldNode,
|
||||
//NoteContent: foldInside,
|
||||
NoteContent(node) {
|
||||
return {from:node.from, to:node.to-1}
|
||||
},
|
||||
}),
|
||||
],
|
||||
wrap: configureNesting(),
|
||||
}),
|
||||
languageData: {
|
||||
commentTokens: {line: ";"}
|
||||
}
|
||||
})
|
||||
|
||||
export function heynoteLang() {
|
||||
let wrap = configureNesting();
|
||||
let lang = HeynoteLanguage.configure({dialect:"", wrap:wrap});
|
||||
return [
|
||||
new LanguageSupport(lang, [json().support]),
|
||||
]
|
||||
}
|
||||
|
||||
/*export function heynote() {
|
||||
return new LanguageSupport(HeynoteLanguage)
|
||||
}*/
|
||||
|
@ -10,7 +10,7 @@ import { javaLanguage } from "@codemirror/lang-java"
|
||||
import { lezerLanguage } from "@codemirror/lang-lezer"
|
||||
import { phpLanguage } from "@codemirror/lang-php"
|
||||
|
||||
import { NoteContent, NoteLanguage } from "./heynote.terms.js"
|
||||
import { NoteContent, NoteLanguage } from "./parser.terms.js"
|
||||
|
||||
|
||||
const languageMapping = {
|
||||
|
@ -1,44 +1,17 @@
|
||||
import { parser } from "./heynote.js"
|
||||
import { configureNesting } from "./nested-parser.js";
|
||||
|
||||
import {LRLanguage, LanguageSupport, indentNodeProp, foldNodeProp, foldInside, delimitedIndent} from "@codemirror/language"
|
||||
import {styleTags, tags as t} from "@lezer/highlight"
|
||||
|
||||
import { json } from "@codemirror/lang-json"
|
||||
import { javascript } from "@codemirror/lang-javascript"
|
||||
|
||||
|
||||
function foldNode(node) {
|
||||
//console.log("foldNode", node);
|
||||
return {from:node.from, to:node.to-1};
|
||||
//let first = node.firstChild, last = node.lastChild;
|
||||
//return first && first.to < last.from ? { from: first.to, to: last.type.isError ? node.to : last.from } : null;
|
||||
}
|
||||
|
||||
export const HeynoteLanguage = LRLanguage.define({
|
||||
parser: parser.configure({
|
||||
props: [
|
||||
styleTags({
|
||||
NoteDelimiter: t.tagName,
|
||||
}),
|
||||
|
||||
foldNodeProp.add({
|
||||
NoteContent: foldNode,
|
||||
}),
|
||||
],
|
||||
wrap: configureNesting(),
|
||||
}),
|
||||
languageData: {
|
||||
commentTokens: {line: ";"}
|
||||
}
|
||||
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
||||
import {LRParser} from "@lezer/lr"
|
||||
import {noteContent} from "./external-tokens.js"
|
||||
export const parser = LRParser.deserialize({
|
||||
version: 14,
|
||||
states: "!WQQOPOOOVOPO'#C`O[OQO'#C_OOOO'#Cb'#CbQQOPOOOaOPO,58zOOOO,58y,58yOOOO-E6`-E6`OOOQ1G.f1G.f",
|
||||
stateData: "f~OWPO~OTTO~OPUO~OXWO~O",
|
||||
goto: "fVPPPW[P`TROSTQOSQSORVS",
|
||||
nodeNames: "⚠ NoteContent Document Note NoteDelimiter NoteLanguage",
|
||||
maxTerm: 9,
|
||||
skippedNodes: [0],
|
||||
repeatNodeCount: 1,
|
||||
tokenData: "&e~RXYZn#[#]s#^#_![#`#a#u#a#b$_#d#e%T#g#h%p#h#i%v%&x%&y&S~sOX~~vP#h#iy~|P#a#b!P~!SP#`#a!V~![OT~~!_Q#T#U!e#g#h#i~!hP#j#k!k~!nP#T#U!q~!vPT~#g#h!y~!|P#V#W#P~#SP#f#g#V~#YP#]#^#]~#`P#d#e#c~#fP#h#i!V~#lP#c#d#o~#rP#b#c!V~#xP#X#Y#{~$OP#n#o$R~$UP#X#Y$X~$[P#f#g!V~$bP#T#U$e~$hP#f#g$k~$nP#_#`$q~$tP#W#X$w~$zP#c#d$}~%QP#k#l#o~%WQ#[#]%^#m#n%d~%aP#d#e!V~%gP#h#i%j~%mP#[#]#i~%sP#e#f!P~%yP#X#Y%|~&PP#l#m#c~&VP%&x%&y&Y~&]P%&x%&y&`~&eOW~",
|
||||
tokenizers: [0, noteContent],
|
||||
topRules: {"Document":[0,2]},
|
||||
tokenPrec: 0
|
||||
})
|
||||
|
||||
export function heynoteLang() {
|
||||
let wrap = configureNesting();
|
||||
let lang = HeynoteLanguage.configure({dialect:"", wrap:wrap});
|
||||
return new LanguageSupport(lang, [json().support])
|
||||
}
|
||||
|
||||
/*export function heynote() {
|
||||
return new LanguageSupport(HeynoteLanguage)
|
||||
}*/
|
||||
|
@ -3,7 +3,7 @@ import { layer, RectangleMarker } from "@codemirror/view"
|
||||
import { EditorState, RangeSetBuilder, StateField } from "@codemirror/state";
|
||||
import { RangeSet } from "@codemirror/rangeset";
|
||||
import { syntaxTree } from "@codemirror/language"
|
||||
import { Note, Document, NoteDelimiter } from "./lang-heynote/heynote.terms.js"
|
||||
import { Note, Document, NoteDelimiter } from "./lang-heynote/parser.terms.js"
|
||||
import { IterMode } from "@lezer/common";
|
||||
import { INITIAL_DATA } from "./annotation.js";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user