- Fixed the way steps were parsed that restricted special characters and made the parsing quirky overall. Now the lexer is a multi-mode lexer so that the steps can really be free form.
- Updated the return types from the
toRecipe
,toIngredients
, andtoSteps
functions so that they return a type specific to the action. This cleans up the typing, making it altogether less confusing. - Parser and CST visitor now takes parser options to select the input-type (recipe, steps, ingredients) and whether to create a new lexer and/or parser.
- The
toRecipe(...)
function has been renamed toconvertText(...)
, but I encourage you to use the newtoRecipe(..)
,toIngredients(...)
, and thetoSteps(...)
functions instead. - The
RecipeResult
type is now parameterized by the return type (i.e.Recipe
,Array<Ingredient>
, andArray<Step>
), and the fieldrecipe
has been renamed toresult
. - Added functions
toRecipe(..)
,toIngredients(...)
, and thetoSteps(...)
that return aRecipeResult<Recipe>
,RecipeResult<Array<Ingredients>>
and aRecipeResult<Array<Step>>
, respectively.
Fixed the typing in the RecipeResult
so that it is either a full Recipe
, or when the
input type is for ingredients, then Array<Ingredient>
, or when the input type is for steps,
then an Array<Step>
.
Updated the regular expressions used for lexing to allow accented characters in ingredients and sections.
Initial version that parses a recipe consisting of ingredients and steps, or the ingredients, or the steps, separately.