add just and cons to stubbed in typevariant information

This commit is contained in:
mdgriffith 2020-07-29 09:25:53 -04:00
parent c26a70f0d7
commit 05b9fea928

View File

@ -10,54 +10,45 @@ elmParser.setLanguage(Elm);
// List variants
const nil: ElmVariant = {
typeName: "List",
name: "Nil",
jsName: "_List_Nil",
typeName: 'List',
name: 'Nil',
jsName: '_List_Nil',
index: 0,
slots: [],
totalTypeSlotCount: 2
}
totalTypeSlotCount: 2,
};
const cons: ElmVariant = {
typeName: "List",
name: "Cons",
jsName: "_List_Nil",
typeName: 'List',
name: 'Cons',
jsName: '_List_Nil',
index: 1,
slots: [],
totalTypeSlotCount: 2
}
const listVariants =
[nil
// , cons
]
slots: ['a'],
totalTypeSlotCount: 2,
};
const listVariants = [nil, cons];
// Maybe variants
const nothing: ElmVariant = {
typeName: "Maybe",
name: "Nothing",
jsName: "$elm$core$Maybe$Nothing",
typeName: 'Maybe',
name: 'Nothing',
jsName: '$elm$core$Maybe$Nothing',
index: 1,
slots: [],
totalTypeSlotCount: 1
}
totalTypeSlotCount: 1,
};
const just: ElmVariant = {
typeName: "Maybe",
name: "Just",
jsName: "$elm$core$Maybe$Just",
typeName: 'Maybe',
name: 'Just',
jsName: '$elm$core$Maybe$Just',
index: 0,
slots: [],
totalTypeSlotCount: 1
}
const maybe = [nothing]
slots: ['a'],
totalTypeSlotCount: 1,
};
const maybe = [nothing, just];
export const parseElm = ({
author,
@ -69,7 +60,10 @@ export const parseElm = ({
source: string;
}): { [id: string]: ElmVariant[] } => {
const tree = elmParser.parse(source);
const found: { [id: string]: ElmVariant[] } = { "List": listVariants, "Maybe": maybe };
const found: { [id: string]: ElmVariant[] } = {
List: listVariants,
Maybe: maybe,
};
/*
A quick reference for using treesitter.