#Migrating from 1.0.0-rc15
and earlier
With 1.0.0-rc16
, some major changes were made to arguments
, categories
,
and qualifiers
, to simplify interactions.
- All phrases can now have
arguments
,categories
,qualifiers
, orannotations
. They can also use these in the singular form. - The
<label />
phrase was removed, and replaced with<placeholder />
. Sincearguments
had been split out, there was no longer a need for any<label />
functionaliy except suppression. - There are 4 new
Option
properties:arguments
,categories
, andannotations
. Each have the same structure:
arguments: {value: 'argument value', start: 0, end: 2}
Where start
is the index of the first word
with that argument
, and end
is the
index of the last word without that argument.
qualifiers
follows the above format as well.category
andargument
are no longer output withwords
.
With version 1.0, changes will slow considerably and the API will stabilize. For those who did build on 0.x, here's what changed:
- The package name has changed from
lacona
toelliptical
to reduce confusion about its relationship with the Lacona app. lacona-phrase
is no longer used.createElement
is now a part of elliptical proper.- Phrases are no longer represented as classes, but rather plain objects.
validate
has been renamed tofilterResult
mapResult
was added- there is no longer a
Parser
class. Instead, you simply compile a grammar, which returns an unbound parse method. parseArray
has been renamed toparse
. The ability to access output options as an Iterator was removed.
/* old */
const parser = new Parser()
parser.grammar = <MyPhrase />
const outputs = parser.parseArray('')
/* new */
const parse = compile(<MyPhrase />)
const outputs = parse('')
- there is no longer a
LaconaError
class - normal JS errors are thrown. - The phrase method known as
_handleParse
is now known asvisit
. <map>
,<filter>
, and<tap>
are now passed the entireOption
and are always called by default.<map>
,<filter>
, and<tap>
have had theirfunction
prop renamed tooutbound
, andinbound
was added.<map>
no longer has aniteratorFunction
prop - rather, wheneveroutbound
returns anIterable
, it will be treated as such.- Sources and
<dynamic>
have been removed entirely and modularized with elliptical-observe - Extensions have been removed entirely and modularized with elliptical-extend
- Translations have been removed entirely and modularized with elliptical-translate