Commit Graph

240 Commits (af222e2777e72a94a0bf2180dcdf153e92525077)

Author SHA1 Message Date
Mike Gerwitz 01a420fd81 Revert "set_default: Allow empty vectors"
I need to revert this for now because it breaks YAML test cases.  The proper
fix is a more expressive type system with dependent types that would allow
it to know the proper number of indexes to initialize relative to other
inputs.  I wanted to implement this anyway to help catch iteration-related
bugs.

I'm tabling this for now, though, since I have other things that I need to
work on.

This reverts commit 4406cbe553.
2019-01-30 13:45:17 -05:00
Mike Gerwitz f3aa38a0c1 doc: Convert most sections index appendicies
I want this manual to be useful both to developers and users of TAME,
so this distinction needs to be made clear.

* doc/tame.texi (Preprocessor): chapter=>appendix.
* src/graph.texi: Top to appendix and raise subsections.
* src/symtable.texi: Top to appendix.
2019-01-29 15:38:00 -05:00
Mike Gerwitz 4406cbe553 set_default: Allow empty vectors
This is an assumption that's existed since the Summary Page was first
devised---that all vectors have at least one value.  This is because the
bucket (originating from Liza) always has at least one value in its vectors.

Of course, we still have a problem in that the Summary Page initializes
everything to have a single value by default, and that's still the
case.  But this will at least allow for things _outside_ the Summary Page to
provide an empty array.  I'll have to address the Summary Page separately,
and that's going to be difficult, since we don't really want to change the
behavior across the board.

* src/current/compiler/js.xsl (set_defaults): Default max index to 0 if
    `length' is unavailable, rather than 1.
2019-01-29 10:07:36 -05:00
Mike Gerwitz c9ab302f53 map: Proper array check for translation iteration
The previous length check existed as a really bad array check (before
Array.isArray was a thing).  This has been broken since Nov 2012.

The problem manifests itself when you want an empty array.  We then have:
  [] => [[]] => [DEFAULT_VALUE]

* src/current/compiler/map.xsl (lvmc:compile)[lvm:map//lvm:from[*]]: Use
    `Array.isArray' in place of length check.
2019-01-28 14:15:10 -05:00
Mike Gerwitz c3c7cfeeff map.xsl: Escape all output in strings 2018-12-20 14:31:14 -05:00
Mike Gerwitz c7e84f2e29 DslCompiler: Use s9api instead of JAXP
The difference is described here:

  http://www.saxonica.com/html/documentation/using-xsl/embedding/

And s9api here:

  http://www.saxonica.com/html/documentation/using-xsl/embedding/s9api-transformation.html

* Makefile.am (DSLC_CLASSPATH): Export for submakes.
* configure.ac (DSLC_CLASSPATH): Prefix with SAXON_CP.
* rater/rater.xsd (classNameType): Increase length 50=>75 (generated
    identifiers can now exceed that, it seems).
* src/current/rater.xsd: Likewise.  These files need to be combined.
* src/current/src/Makefile (CLASSPATH): Set to DSLC_CLASSPATH.
* src/current/src/com/lovullo/dslc/DslCompiler.java: Update imports.
  (DslCompiler)[_DslCompiler]: New members _processor and
    _xsltCompiler.  Convert to s9api.
2018-12-18 13:33:25 -05:00
Mike Gerwitz 219a4b521a summary: Remove reset button
This has been broken for years.  I don't object to fixing it, it's just that
I have better things to do right now and we've gotten complaints about it;
no use in keeping around something that's broken if there's no desire to fix
it.  Workaround: refresh the page.

This does keep around the reset logic because it is actually used in other
places.

* src/current/include/entry-form.xsl (entry-form)[lv:package]: Remove reset
    button.
* src/current/include/entry-form.js (clearTestCases): Remove broken function
    call `Prior.setPriorMessage(null)'.
2018-12-05 10:21:25 -05:00
Mike Gerwitz bcd8a67bd9 summary: Sans-serif font stack
It wasn't until recently that I realized that the default browser font was
being used, since I have mine customized.

* src/current/summary.css (body)[font-family]: Sans-serif font stack.
2018-12-05 10:14:08 -05:00
Mike Gerwitz fe14db7379 map: Correctly set translation defaults given the symbol dimensions
* src/current/compiler/map.xsl:
  (lvmc:gen-input-default): Add argument.
    [dim]: New param, defaulting to `$sym/@dim'.
  (lvmc:compile)[lvm:map//lvm:from[*]]: Provide appropriate dimension value
    to `set_defaults'.  Provide compile-time error if nesting of `from'
    nodes exceeds what is appropriate for the symbol dimensions.
2018-12-04 16:56:53 -05:00
Mike Gerwitz 6e4d42f926 DslCompiler: Properly output errors and termination line
This fixes a number of obnoxious miscellaneous issues, summarized below.

* src/current/src/com/lovullo/dslc/DslCompiler.java (DslCompiler)[compile]:
    Output termination line (DONE) on missing destination path
    error.  Always output exception message before termination
    line (otherwise it won't output to the user).  Output termination line
    and remove destination file for XSD failure.
2018-12-04 13:45:46 -05:00
Mike Gerwitz 10106993b5 map: Always terminate on missing destination symbol
This was a bit of a nasty one.  Fortunately, this was only used as a
validation, so the code that the compiler produced was still correct.

The problem was that a version of Saxon sometime between 9.5 and 9.8 added
an optimization to eliminate conditionals with no body.  Consequently, the
kluge to force the variable to be evaluated was optimized away,
`lvmc:get-symbol' was never called, and no error was ever produced.

This would be best refactored, but that's not something I have time to take
up at the moment priority-wise.  This should be future-proof since this
would never be a noop.

* src/current/compiler/map.xsl (lvmc:compile)[lvm:map//lvm:from[*]]: Force
    evaluation of `$sym' by ensuring that the condition will not be a noop.
2018-12-04 12:06:40 -05:00
Mike Gerwitz 210693c22f [DEV-3958] c1map: Make output PHP namespace configurable
* src/current/c1map.xsl (lvm:c1map): Copy `@namespace' to generated
    `lvmp:root'.
* src/current/c1map/render.xsl (lvmp:render)[lvmp:root]: Output
    `@namespace' rather than using hardcoded string and dynamic program.
2018-11-28 16:42:04 -05:00
Mike Gerwitz 7f3e279cfa anyValue: Always yield a matrix if any predicate is a matrix
This is a long-standing bug, apparently.  The location of this code makes it
difficult to test directly (that is in dire need of correcting), but
fortunately we have a number of tests in systems that use TAME that
indirectly test this.

The problem manifested when a matrix was already in the store, but then a
scalar or vector predicate was considered.  Without making the branch that
was modified here, it modified store such that it would always yield a
vector.

* src/current/compiler/js.xsl (anyValue): Consider store dimension when
    recursing.
2018-11-21 15:19:44 -05:00
Mike Gerwitz 5cb78cc47d dslc: Invoke with static rater path
This frees us from requiring a rater/ directory in the working
directory.  However, it is important that we continue using it if it
exists, since there are additional things that haven't yet been moved
into the tame repo.

* bin/dslc.in: Provide path to rater/ directory.
* src/current/src/com/lovullo/dslc/DslCompiler.java: Use provided rater/ path.
2018-11-08 09:26:07 -05:00
Mike Gerwitz 8143207903 Support non-xmlo dependencies for input map @src
* build-aux/gen-make: Do not add ".xmlo" suffix for deps with a
    trailing `$'.
* src/current/pkg-dep.xsl (lvm:program|lvm:return-map): Append ".xml$" to
    dep for map/@src (new dep).
2018-10-19 10:15:11 -04:00
Mike Gerwitz 1e5cdf8c40 src/current/src/Makefile: Phony recursive targets
Otherwise *-recursive fails.

* src/current/src/Makefile (check, info, pdf, html): New phony targets.
2018-10-16 09:10:15 -04:00
Mike Gerwitz 6027769633 Integrate new compilation scripts, remove cqueue and Makefile.2
This is a major step toward normalcy---removing the kluge of a build process
that was causing so many issues.  Rather than echoing all operations to a
queue file before passing it off to dslc, the new build scripts in `bin/'
are used to invoke tame normally, as needed.  This solves all of the current
issues with things not rebuilding when they should.  And, as a bonus, tab
completion on targets works.

Sorry this took so long.  There wasn't much motivation until we hired so
many people that are suffering from this.

This does a few major things, along with some miscellaneous others:
  - Invoke bin/tame directly;
  - Merge Makefile.2.in into Makefile.am; and
  - Fix up some targets.

* build-aux/Makefile.2.in: Delete file.  Mostly merged with Makefile.am.
* build-aux/Makefile.am: Add a bunch of new targets and definitions from
    Makefile.2.in.  Modify all that previously used .cqueue to now invoke
    `$(TAME)' directly.  Remove miscellaneous targets for trying to proxy
    targets to Makefile.2.
  (saneout, _go): Remove definitions.
  (.NOTPARALLEL): Add to prevent parallel builds.
  (ui/program.expanded.xml)[.version.xml]: Remove dependency for now.
  (clean): Also clean generated PHP files.  Follow symlinks to clean core.
    This is still incomplete (does not clean all rate table stuff).
  (suppliers.mk)[xmlo_cmd]: Remove.  See `gen-make' and `gen-c1make'.
  (lvroot)[summary-html]: New dependency.
  (kill-tamed, tamed-die): New targets (former alias of latter) to kill
    tamed.
* build-aux/gen-c1make: Generate `$(TAME)' invocation.
* build-aux/gen-make: Likewise.  Remove `xmlo_cmd' output.  Ignore recursive
    `tame' symlink (this can be removed once we clean `rater/' up.
* build-aux/m4/calcdsl.m4 (TAME): Update description to reflect that it
    should now be the path to `bin/tame'.  Adjust `AC_CHECK_FILE' lines
    accordingly.
  (tame_needed_ver): Remove.  We have been in the same repo as TAME itself
    for quite some time.  Remove associated code.
  (AC_CONFIG_FILES): Remove `Makefile.2'.
* src/current/src/com/lovullo/dslc/DslCompiler.java (_DslCompiler)[compile]:
    Perform validation prefore `compile' command rather than a separate
    `validate' step.  Remove `rm'.
  [compileSrc]: Stop echoing command.  This was only necessary because of
    the previous Makefile klugery; now Make echoes on its own correctly.
2018-10-11 22:25:18 -04:00
Mike Gerwitz 88da519c5e template.xsl: Remove eseq:expand-node function @override
* src/current/include/preproc/template.xsl (eseq:expand-node)[@override]:
  Remove attribute (deprecated by Saxon and unneeded).
2018-10-11 21:03:51 -04:00
Mike Gerwitz cf57857ce5 bin/: Server/client build scripts
These scripts allow the TAME compiler stack to be invoked naturally, rather
than requiring the use of a Makefile today.  This will not only allow users
to more easily invoke the compiler, but will also allow us to invoke TAME
naturally from Makefile and remove the klugery that has existed for so
long.

This users a server/client architecture in order to mitigate the startup
cost of the JVM.  More documentation will follow.

Note that there are a bunch of symlinks in rater/---this is a transition
step to allow the build to continue working as it did before, which relies
on a directory structure that exists outside of this repository.  This will
be cleaned up in the future.

* .gitignore (bin/dslc): Add ignore for generated file.
* bin/dslc.in: New script to encapsulate Java invocation.
* bin/tame: New script (client).
* bin/tamed: New script (server).
* configure.ac (JAVA_OPTS, DSLC_CLASSPATH, AUTOGENERATED): New variables for
  dslc.in.  Output bin/dslc.
* rater/README.md: Note that this symlink mess is temporary.
* rater/c1map: New symlink for dslc assumptions.
* rater/c1map.xsl: Likewise.
* rater/calc.xsd: Likewise.
* rater/compile.xsl: Likewise.
* rater/compiler: Likewise.
* rater/dot.xsl: Likewise.
* rater/include: Likewise.
* rater/link.xsl: Likewise.
* rater/standalone.xsl: Likewise.
* rater/summary.xsl: Likewise.
* rater/tame: Likewise (warning: circular symlink).
* src/current/src/com/lovullo/dslc/DslCompiler.java (_DslCompiler)[compile]:
  Output `DONE' lines.
2018-10-08 23:25:02 -04:00
Mike Gerwitz 4ad0c5d1be Include dslc Java build as submake
This will now automatically build on recursive target `all'.

* Makefile.am (SUBDIRS): Add `src/current/src'.
* src/current/src/Makefile: (.PHONY): Add `all'.
  (all): New target.  Alias to `dslc'.
2018-10-08 23:07:41 -04:00
Mike Gerwitz 607abd281d expand-sequence: Fix TeX escaping
* src/preproc/expand/expand-sequence.xsl: {\\=>\}.
2018-09-12 16:51:11 -04:00
Mike Gerwitz e18d5bb4b5 symbols: Remove last remnants of @keep
* src/symtable/symbols.xsl (preproc:symtable)[lv:param]: Remove @keep.
* test/symtable/symbols.xspec: Remove @keep.
2018-09-12 12:07:25 -04:00
Mike Gerwitz ed5f3d151e Add src/ symlink to doc/
Most LaTeX distributions prohibit loading files from parent
directories.  This gets around that for PDF builds.

* doc/src: Add symlink.
* doc/tame.texi, src/symtrable.xsl: Use it.
2018-09-12 12:07:25 -04:00
Mike Gerwitz f169c91927 expand: Correct priority of constant suffix templates
* src/current/include/preproc/expand.xsl (preproc:expand)[c:const]: Adjust
  priorities.
2018-09-10 15:37:17 -04:00
Mike Gerwitz 91316d1e8f js compiler: Escape exception string
* src/current/compiler/js.xsl (compile)[lv:classify]: Escape output for
  Error.
2018-09-07 14:25:24 -04:00
Mike Gerwitz ea7e0e1565 preproc: Remove @override from eseq:is-expandable function
This was throwing a warning in non-ancient versions of Saxon.  It does not
need to be there, nor should it be, nor do I know why it was put there.

* src/current/include/preproc/template.xsl (eseq:is-expandable): Remove
  @override.
2018-07-13 23:49:18 -04:00
Mike Gerwitz d624ee6d7e linker: Use sequences for stacks (instead of trees)
This has a significant performance impact: processing time is cut in about
half and memory usage is reduced by more than 50%.  For example, a
package that previously took 30s and 2.1GiB of memory to link now takes
14s and less than 900MiB of memory.

I had tried to perform this optimization a couple years ago but was
thwarted (I think) by the classifier markers.  The previous commit did away
with those.  I'm encouraged by the gains from the low-hanging fruit.

* src/current/compiler/linker.xsl
  (l:process-empty, l:stack-empty): Convert from l:pstack and
    l:sym-stack (respectively) to empty preproc:sym sequences.
  (l:depgen-process-sym)[preproc:sym]: Append to sequence rather than
    outputting new l:sym-stack tree.
  Update all annotations and uses accordingly.
2018-07-13 23:40:48 -04:00
Mike Gerwitz f2db9f1268 linker: Remove classifier vs. calculation distinction
This is something that I thought would be useful back in the day when TAME
was in its infancy, but it is not important.  Rather than having the linker
spend time trying to figure out what symbols belong in the classifier---and
rather than keeping that complexity around---this simplifies things by
making the existing `classify' method simply perform _all_ calculations, and
then yield only the classification portion of the result.

This isn't a problem in practice because, if we only desire the use of a
classifier, then we create a "supplier" that only uses classifications and
has no other dependencies.  The end result is, as far as we care, the same.

* src/current/compiler/js.xsl (compiler:entry-rater)[lv:package]: Initialize
    `classes' rather than invoking classifier
  (compiler:entry-classifier)[lv:package]: Invoke all calculations and
    return only classes to provide equivalent behavior.
  (compiler:exit-classifier): Post-process classifications from calculation
    results, iterating through classmap.
  (compiler:classifier-yields-map)[lv:package]: Output all classifications
    that are not generated.  This differs slightly from the original
    implementation in that it includes all non-generated classes rather than
    just classes that have a non-generated `@yields'; this distinction is
    important since `compiler:exit-classifier' is now using it to produce a
    classification result set that doesn't contain all the generated
    stuff (since it didn't before, and shouldn't now).
* src/current/compiler/linker.xsl: Update copyright year.
  (l:resolv-deps)[preproc:sym[@l:mark-inclass]]: Remove template.
  (l:resolv-deps)[preproc:sym...@l:mark-inclass...]: Remove template.
  (l:depgen-sym): Set type of result to `element(preproc:sym)', since
    `l:mark-inclass' is no longer produced.
    [inclass, needs-class-mark]: Remove variables and all instances where
      they are used.
  (l:dep-aug)[inclass]: Remove param.  Stop producing `@inclass' attribute.
  (l:link-classifier)[lv:package]: Do not process any dependencies.  This
    can be removed entirely in the future since it now only produces static
    code, which we can perhaps combine with a different block.
  (l:link-rater)[lv:package]: Remove mention of `inclass' for dependencies;
    all dependencies will now be compiled into this block.
2018-07-13 13:08:52 -04:00
Greg Torbenson 84f9321a4d [DEV-3251] factor escape check out to a function, and also fix a bug. 2018-07-02 10:27:53 -04:00
Greg Torbenson 5cbffa9c10 remove debug code 2018-06-29 17:15:00 -04:00
Shelly Shaver c2504d89c0 add support for escape-param attr 2018-06-29 17:14:57 -04:00
Greg Torbenson fc60f98908 Don't break interpolated comparison attributes when fixing static comparisons. 2018-06-27 14:03:38 -04:00
Taylor Cordes badb1a59f8 [DEV-3245] fixed bug preventing second paramater in conditionals 2018-06-26 09:06:50 -04:00
Taylor Cordes 1628cc0aa6 Revert "fixed bug preventing second parameter in conditionals"
This reverts commit 80ed214e12.
2018-06-25 16:21:12 -04:00
Taylor Cordes 80ed214e12 fixed bug preventing second parameter in conditionals 2018-06-25 14:16:32 -04:00
Mike Gerwitz eef3eb85ea map: Uppercase and hash transformers
This includes a SHA256 implementation which is _not_ intended for secure
cryptographic operations; see src/js/sha256.js header for more information.

* src/current/compiler/js.xsl (compiler:static): Echo src/js/sha256.js.
  [map_method_uppercase, map_method_hash]: New functions.
* src/current/link.xsl: Include dslc-base.xsl.
* src/js/sha256.js: New file.
2018-05-29 11:16:59 -04:00
Mike Gerwitz 3f7e1fc9b8 map: Add transformation support
* src/current/compiler/map.xsl
  (lvmc:get-method-func, lvmc:value-ref, lvmc:transformation-wrap): New
    functions, partyl extracted from below.
  (lvmc:compile)[lvm:map//lvm:from]: Use `lvmc:value-ref'.
    [lvm:map//lvm:from/lvm:translate]: Add `[@key]' to match.
    [lvm:map//lvm:transform]: New match.  Ignore node entirely.
  (lvmc:concat-compile): Propagate symtable to `lvmc:compile'.
2018-05-29 10:53:48 -04:00
Mike Gerwitz 2a9196d940 Add __path-root param
* src/current/include/dslc-base.xsl (__path-root): New param.
* src/current/src/com/lovullo/dslc/DslCompiler.java
  (DslCompiler)[compile]: Resolve TAME root path.
    [_transform]: Set it.

DEV-3115
2018-05-29 10:50:53 -04:00
Mike Gerwitz e3b0baec1a Cut down on namespace exports for object files
This should cut down on the file sizes a bit.
2018-05-15 13:03:38 -04:00
Greg Torbenson f2e3cdf5f7 Modify valparse to recurse into the RHS. 2018-05-09 12:07:57 -04:00
Mike Gerwitz 70f9e9c277 Move {src/current/tools=>build-aux}/* 2018-05-04 11:17:47 -04:00
Mike Gerwitz 4554013356 map: Support @index on all lvm:from
* src/current/compiler/map.xsl (lvmc:compile)[lvm:map//lvm:from[*]]: Output
    index if @index is set.
2018-04-16 11:11:21 -04:00
Mike Gerwitz ba1faa74da map: Support `from' within `set'
This was just a matter of proxying `type'.

* src/current/compiler/map.xsl (lvmc:compile): Proxy `type' param.
2018-04-16 11:11:19 -04:00
Mike Gerwitz 6a45b2c95a map: Tunnel symtable
Simplifies coming changes.

* src/current/compiler/map.xsl: Tunnel all `symtable' params.
2018-04-11 14:28:11 -04:00
Mike Gerwitz 8a17d0c6c5 c1map: Add lvm:when
This allows for conditional nodes where lvm:if is not appropriate or cannot be
used.
2018-04-06 15:03:32 -04:00
Mike Gerwitz 6d0f4fd458 c1map: Prevent iteration on conditionals
This does not work at all.
2018-04-06 14:56:35 -04:00
Mike Gerwitz 986b2a7b4b map: Provide useful warnings when missing import/@path
This is all really confusing because this doesn't use the same import
specification as packages; maps got stuck in a partial transition.  So,
let's provide some helpful errors rather than silently failing.

* src/current/compiler/map.xsl (preproc:symtable)[lvm:import]:
    Error if missing `@path'.  Provide more information if `@package' was
    provided to help clarify.
2018-04-05 15:53:54 -04:00
Mike Gerwitz c15ed8a2cd Add class, param, const, rate to param-value/@identifier
* src/current/include/preproc/template.xsl
  (preproc:gen-param-value-style)[lv:param-value[@identifier]]: Add support
  for class, param, const, rate styling.
2018-04-02 12:40:50 -04:00
Mike Gerwitz 189751d5cc Mark generated symbols as local
We need to cut down on symbol imports as much as possible; the whole system
starts dragging if we are importing thousands of symbols into a single
package.

* src/current/include/preproc/symtable.xsl (preproc:symtable)[lv:rate,c:*]: Mark
  as local if `@preproc:generated`.
* src/current/include/preproc/template.xsl (preproc:macros)[lv:inline-template]:
  Mark generated templates as such.
* src/symtable/symbols.xsl (preproc:symtable)[lv:template]: Mark as local if
  `@preproc:generated'.
2018-03-28 14:22:57 -04:00
Mike Gerwitz 852c42e340 symtable: Detect duplicate symbols in the same package
* src/symtable.xsl (symtable:find-duplicates):
  Update description.  Find duplicates in same package.
* test/symtable.xspec: Update test case accordingly.
2018-03-28 10:30:15 -04:00
Mike Gerwitz d284d75f39 js compiler: Prevent octals in generated code
* src/current/compiler/js.xsl (compiler:js-number): New function to
    remove leading zeroes.
  (compile)[lv:const]: Use it.
* src/current/compiler/js-calc.xsl (compile-calc)[c:const]: Use it.
2018-03-28 10:30:12 -04:00
Shelly Shaver 67d0cd69ec c1map: Add lvm:if/@eq 2018-03-21 14:46:10 -04:00
Mike Gerwitz a3fcaa8737 rate-each: Gentle @no
* src/current/compiler/js.xsl (compile-class-condtion)[lv:rate]: Do not
  consider @no's in predicate generation when `@preproc:gentle-no' is set.
* src/current/include/preproc/macros.xsl (preproc:macros)[lv:rate-each]: Set
  `@preproc:gentle-no' on generated `lv:rate', since the generator handles
  `@no' itself.
2018-03-19 15:23:41 -04:00
Mike Gerwitz 2960f2d0b3 linker, summary: Reduce runlog output 2018-03-19 15:08:17 -04:00
Mike Gerwitz 5b5055db6d preproc/template: Add param-sym-value/@ignore-missing
* src/current/include/preproc/template.xsl
  (preproc:gen-param-value)[lv:param-sym-value]: Suppress warning for
  missing symbol and yield empty string if `@ignore-missing='true'`.
2018-03-16 16:24:06 -04:00
Mike Gerwitz abca20b02d depgen: Include enum constants as typedef dependencies
This ensures that they are compiled into the `consts' object.

* src/current/include/depgen.xsl (preproc:depgen)[lv:typedef]: Include
  `lv:enum/lv:item/@name' as dependencies.
2018-02-28 15:29:49 -05:00
Mike Gerwitz b70cbb9eae standlone: Correct consts reference for worksheet
This was broken in 0c020b7.

* src/current/standalone.xsl (/): {rater_results=>rater}.consts.
2018-02-26 10:39:03 -05:00
Mike Gerwitz 5b256e0268 symtable: Do not mark symbols with generated yields as generated
The problem with this implementation was that, any time a generator had an
associated generated @yields (which is common), it wouldn't be included in
the summary page.

We can address this in the future.  It's not necessarily that it was
incorrect; it's just how the system made use of it.

* src/current/include/preproc/symtable.xsl (preproc:symtable)[lv:rate]:
  Do not mark @preproc:yields-generated symbols as @preproc:generated.
2018-02-26 10:31:04 -05:00
Mike Gerwitz d8cbee12b2 validtor: Remove unresolved extern warning
See diff comment.

* src/current/compiler/validate.xsl (lvv:validate)[c:*[@name or @of]]:
  Remove unresolved extern warning.
2018-02-26 10:30:42 -05:00
Mike Gerwitz 6b7e75c886 entry-form: Integrate YAML test case console output as HTML 2018-02-23 14:20:16 -05:00
Mike Gerwitz 3bf15ebcc1 depgen: Ignore template bodies
Templates can expand into unexpected places, so sometimes warnings are
inappropriately issued.

* src/current/include/depgen.xsl (preproc:depgen)[lv:template]: Ignore.
  [lv:template/lv:param]: Remove (now unnecessary with above).
2018-02-23 13:45:07 -05:00
Mike Gerwitz 3384c95bc9 Revert "program map: Use expanded (preprocessed) program"
This map is used for more than the program.xml!

This reverts commit c64e8363fd.
2018-02-22 16:42:26 -05:00
Mike Gerwitz c64e8363fd program map: Use expanded (preprocessed) program
* src/current/compiler/map.xsl (lvmc:compile)[lvm:program-map]: Use
  `program.expanded', which is the preprocessed output.
2018-02-22 16:25:10 -05:00
Mike Gerwitz 4b1a72db81 entry-form: Clear YAML filename after loading
This way the test case can be re-loaded; otherwise it is
not recognized as a change and does not trigger the event.
2018-02-19 15:21:14 -05:00
Mike Gerwitz a52cbcea41 Correct param initialization 2018-02-19 15:21:14 -05:00
Mike Gerwitz 4e3a86866a progtest: Display reader errors in browser 2018-02-19 15:21:14 -05:00
Mike Gerwitz f788edd675 Initial embedding of YAML test case runner 2018-02-19 15:21:14 -05:00
Mike Gerwitz 0c020b736d Produce consts as part of rater object 2018-02-19 15:21:14 -05:00
Mike Gerwitz 7f26db41b2 Properly re-order classification predicates of any dimension
In order for the cmatch algorithm to work properly, predicates must be
re-ordered on @dim descending.

* src/current/compiler/js.xsl (compile)[lv:classify]: Order all different
  dimensions, not just scalars.
2018-02-19 13:56:08 -05:00
Mike Gerwitz 34b82e7f7e preproc: Fix lv:any-only conversion broken from last commit
Gah.

This system really needs tests.
2018-02-19 11:41:27 -05:00
Mike Gerwitz 1f545a11ff preproc: Expand templates in extracted classes
any/all blocks within classifications are extracted into their own
classifications.  When they have sibling nodes, the extracted
classifications did not have their templates expanded.  Ouch.
2018-02-19 11:30:49 -05:00
Mike Gerwitz f15a1bb063 Copyright update (R-T Specialty) 2018-02-01 13:11:52 -05:00
Mike Gerwitz cac38d5e06 lv:rate/@generates: Validation error (bugfix)
* src/current/compiler/validate.xsl (lvv:validate)[lv:rate[@generates]]:
  Throw validation error.
2018-02-01 13:08:03 -05:00
Mike Gerwitz c5fcc3ccd2 template: Add prefix and suffix conditional support (feature)
* src/current/include/preproc/template.xsl (preproc:apply-template-cmp): Add
  @prefix and @suffix.
2018-02-01 13:08:03 -05:00
Mike Gerwitz c0370690f4 validate: Error on nested rate blocks (bugfix)
* src/current/compiler/validate.xsl (lvv:validate)
    [lv:rate[ancestor::lv:rate]]: Error on nested rate block.
2018-02-01 13:08:03 -05:00
Mike Gerwitz 9c4fbdace9 symtable: Only consider first lv:rate ancestor for parent (bugfix)
This is a situation that should never happen (I haven't yet determined
whether or not we should support this type of thing in the future), but when
it does, do something intelligent.

* src/current/include/preproc/symtable.xsl (preproc:symtable)[c:*[@generates]]:
  Consider only first ancestor lv:rate.
2018-02-01 13:07:51 -05:00
Mike Gerwitz b36cc3a942 c:sum/@of: Support let values
It's not good that c:let is still doing its own logic for this.

* src/current/compiler/js-calc.xsl (compile-calc)[c:sum[@of]]: Support c:let
  values.
2018-01-30 12:10:11 -05:00
Mike Gerwitz f2a9cd6af8 calc.xsd: Allow ##other in consts
* src/current/calc.xsd (constType): Allow ##other
2018-01-29 16:30:56 -05:00
Mike Gerwitz 9747d16464 Permit matrix reference in c:length-of (bugfix)
* src/current/compiler/validate.xsl (lvv:validate)[c:value]: Allow direct
  matrix reference (without index) in `c:length-of'.
2018-01-29 13:14:02 -05:00
Mike Gerwitz 440b935dc0 Display error on non-scalar constant lv:match/@value (bugfix)
* src/current/compiler/js.xsl (compile)[lv:match]: Display error on bad
  match, as it was intended.
2018-01-29 13:14:02 -05:00
Mike Gerwitz 00ce03ab25 src/current/calc.xsd (nameType): Permit numeric literals (bugfix)
* src/current/calc.xsd (nameType): Permit numeric literals.

These have already been permitted, but the XSD disallowed.
They worked in templates.
2018-01-29 13:13:56 -05:00
Mike Gerwitz 854f87a60d template: Remove accidental debug output
* src/current/include/preproc/template.xsl (preproc:apply-template)[@*]:
  Remove debug output.
2018-01-25 15:39:20 -05:00
Mike Gerwitz d128b2384e entry-form: Ignore missing DOM elements
* src/current/scripts/entry-form.js (updateParamTestcaseDfn): Ignore if DOM
  element cannot be found.
2018-01-25 15:27:27 -05:00
Mike Gerwitz 78ea30e7b5 Retain unknown template param references during expansion
For example, with template-generating templates, if a reference is unknown
and therefore determined to be blank, an attribute might be completely
removed while the template is being generated.  (See the /when package in
core for an example.)  That is not good.

* src/current/include/preproc/template
  (preproc:expand-template): Add `tpl' tunneling param to
    preproc:apply-template application.
  (preproc:apply-template)[@*]: Retain param reference if applying template
    does not define it.
2018-01-25 14:53:31 -05:00
Mike Gerwitz 87a059f0c8 Retain template conditionals verbatim if param unknown
This is important for template-generating templates.

* src/current/include/preproc/template.xsl (lv:if,lv:unlesS):
  Retain conditional nodes verbatim when referenced param is unknown.
2018-01-18 15:44:12 -05:00
Mike Gerwitz 211387ce2f Mark generated @yields on classes and rate-each as such on symbols
* src/current/include/preproc/expand.xsl
  (lv:classify): Set `@preproc:yields-generated' if `@yields' was not
    previously defined.
* src/current/include/preproc/macros.xsl:
  (lv:rate-each): Set `@preproc:yields-generated` if `@yields' was not
    previously defined.
* src/current/include/preproc/symtable.xsl:
  (lv:rate, lv:classify): Set `@preproc:generated` on symbol if
    `@preproc:yields-generated'.
2018-01-16 12:12:33 -05:00
Mike Gerwitz f8d21c1c5f summary: Correct height of pipes denoting length
* src/current/include/calc-display.xsl
  (c:sum[@of], c:length-of): Add `\left', `\right'.
* src/current/summary.xsl: Update "N.B." section.
2018-01-11 08:42:04 -05:00
Mike Gerwitz 2767917d62 summary: Do not terminate on unknown match-desc calculations
Not time to address styling this at the moment.  This code was previously
not reached until recent fixes.  And I forgot that this was even
permitted (such complex calculations within matches)!

* src/current/summary.xsl (match-desc): Do not terminate on unknown
  match-desc elements.
2018-01-09 15:55:39 -05:00
Mike Gerwitz 7ff3a2d702 summary: Correct unknown match calc error display
* src/current/summary.xsl (match-desc): {c=>lv}:classify.
2018-01-09 15:44:16 -05:00
Mike Gerwitz aa99cebc65 Yield 0 and provide warning for empty rate blocks
Rather than producing a syntax error, provide a useful warning and simply
yield 0.

* src/current/compiler/js.xsl (compile)[lv:rate]: Warn and yield 0 when no
    calculation is provided in the body.
2018-01-04 14:51:20 -05:00
Mike Gerwitz 107581017b Support constant refs with lv:match/@on
We've never done this before (thus this bug lasting so many years), but only
because it doesn't really make much sense in practice; this was caught when
writing test cases.

* src/current/compiler/js.xsl (compile)[lv:match]: Compile `consts' instead
    of `args' when referencing a constant.
2018-01-04 14:38:18 -05:00
Mike Gerwitz a62d155eb0 Resolve lv:param-add/@value before processing
* src/current/include/preproc/template.xsl
  (preproc:gen-param-value)[lv:param-add]: Resolve value of @value before
    processing numeric expression (to support template variables).  Error
    when any values are not numeric rather than producing NaN.
2018-01-04 11:05:58 -05:00
Mike Gerwitz d8c7d8fee2 Ignore constant parsing for template param references
This is imperfect, but will work based on current assumptions.

* src/current/include/preproc/expand.xsl (preproc:expand)[c:const,lv:const):
  If '@' is found, do not perform expansion.
2018-01-04 11:04:55 -05:00
Mike Gerwitz cd5a1a99fc summary: Display @desc in breakdown if @label is not available
* src/current/summary.xsl (ultra-breakdown-set): Use @desc if no @label.
2017-12-22 11:13:42 -05:00
Mike Gerwitz 4ed63b3661 summary: Remove index underscores from TeX
They corrupt the display.  This solution isn't ideal, though.

* src/current/include/calc-display.xsl: Use new `preproc:tex-index'.
  (preproc:tex-index): Add function.
* src/current/summary.xsl: Use `preproc:tex-index' for @index display.
2017-12-22 11:07:24 -05:00
Mike Gerwitz 55bd91d05e summary: Simplify display of generators in let list
* src/current/include/display.xsl (preproc:dim-to-str): New function.
  (summary:desc): Use it.  Display appropriate generator dimensions as a
  string rather than hard-coding to `vector'.  Remove yield symbol ref.
2017-12-21 13:39:05 -05:00
Mike Gerwitz 61279a36dc summary: Remove parenthesis from let list symbol refs
* src/current/include/display.xsl: Remove parenthesis around let list
  symbols.
* src/current/summary.xsl: Remove parenthesis around generator symbol.
2017-12-21 13:32:09 -05:00
Mike Gerwitz aba2e7a5b2 summary: Add const description in let list
* src/current/include/display.xsl (summary:desc): Include const @desc in let
  list.
2017-12-21 13:28:17 -05:00
Mike Gerwitz 97977332d5 summary: Correct length notation
Vector length is customarily denoted by |V|.

* src/current/include/calc-display.xsl (c:sum, c:length-of): Use new
  notation.
* src/current/summary.xsl: Update N.B. with new notation.
2017-12-21 13:18:41 -05:00
Mike Gerwitz 93b3a14cfb summary: Remove link from generator name
There's no point in having a link to itself.  Further, the link was wrong.

* src/current/summary.xsl (gen-equation-details): Remove link from generator
  name.
2017-12-21 11:03:22 -05:00