tweak fn parsing

This commit is contained in:
syuilo 2023-01-14 08:59:32 +09:00
parent f916d5bd8f
commit 08cb023e9d
2 changed files with 11 additions and 1 deletions

View file

@ -450,7 +450,7 @@ export const language = P.createLanguage({
P.regexp(/[a-z0-9_]+/i),
P.seq([
P.str('='),
P.regexp(/[a-z0-9_.]+/i),
P.regexp(/[a-z0-9_.-]+/i),
], 1).option(),
]).map(result => {
return {

View file

@ -1199,6 +1199,16 @@ hoge`;
assert.deepStrictEqual(mfm.parse(input), output);
});
it('with a string argument 2', () => {
const input = '$[position.x=-3 a]';
const output = [
FN('position', { x: '-3' }, [
TEXT('a')
])
];
assert.deepStrictEqual(mfm.parse(input), output);
});
it('invalid fn name', () => {
const input = '$[関数 text]';
const output = [