Commit Graph

100 Commits

Author SHA1 Message Date
MineRobber9000 ec1e4a6785 Update README 2018-06-24 23:37:35 -05:00
Justin J. Meza 574f4bb175 fixing some NULL return checks 2016-03-27 14:03:39 -07:00
Justin J. Meza 2844f261f9 fixing interpolated string assignment 2016-03-27 13:56:22 -07:00
Justin J. Meza 84b5c623ff patching with @donabrams's fix 2016-03-27 13:23:57 -07:00
D.E. Akers bc32a948bf add HAS AN keyword for grammatically correct declarations
http://forum.lolcode.org/viewtopic.php?f=4&t=13#p19
2015-08-30 15:46:36 -07:00
D.E. Akers f5f5edb889 relax numeric conversions from string
The spec does not establish any particular constraints to observe in
casting from `YARN` to `NUMB(A)R`. Presently, `lci` checks that the
string consists only of numeric characters prior to attempting the
conversion, halting with an error if it's found not to be the case.

This behavior is often more inconvenient than helpful. Many numeric
strings encountered in the wild are "roughly numeric", and it would be
wise to account for this observation. As a simple example, a user may
be prompted to input a number; in the case of their inadvertently
providing leading or trailing whitespace, a naive program will crash
rather than gracefully extracting the otherwise sensible input.

This patch removes the `isDecString()` function and instead leverages
the `strtoll()` and `strtof()` functions to handle casts from `YARN`
to `NUMBR` and `NUMBAR`, respectively. Thus, strings to be converted
are permitted to contain leading whitespace, and trailing non-numeric
characters are ignored. Additionally, `YARN`s to be cast to `NUMBR`
may lead with `"0"` or `"0x"` to indicate that the string should be
interpreted as an octal or hexadecimal value, respectively.

This change required the modification of several tests which previously
checked that casting an empty or completely non-numeric `YARN` resulted
in an error. These now verify that such a conversion results in a zero
of the appropriate type.
2015-08-30 15:45:53 -07:00
D.E. Akers f1881ad63f add INVISIBLE operator for writing to stderr
Printing warnings and the like to the standard error stream is common
courtesy, not least because it avoids cluttering the program's output
with diagnostic messages.

Neither the 1.2 specification nor any of the proposals for 1.3 mention
using `INVISIBLE` for this purpose. Nevertheless, the operator and the
behavior described herein have seen sufficiently wide adoption in other
LOLCODE interpreters that I believe `lci` would do well to follow suit.

This patch attempts to be minimally invasive. Rather than adding a new
node type and all that that entails, the `PrintStmtNode` structure now
has a `FILE *` field containing the file to which the node should print
during interpretation. This saves a branch in `interpretPrintStmtNode()`
at the cost of making the structure negligibly larger on most systems.

Adding tests for `INVISIBLE` would require rethinking the test driver,
which presently uses the existence of output on `stderr` to detect that
an "expected error" has occurred. I'll happily try my hand at making the
necessary modifications if this patch comes to be accepted.
2015-08-30 15:45:26 -07:00
Justin J. Meza afdd225208 Merge pull request #28 from 0x0dea/interpolate-scribbel
interpolate SCRIBBEL operand
2015-08-30 15:37:06 -07:00
Justin J. Meza f78f669a1d Merge pull request #26 from 0x0dea/interpolate-system-commands
interpolate system commands
2015-08-30 15:34:34 -07:00
D.E. Akers 1bd33cbbd0 interpolate SCRIBBEL operand 2015-08-14 19:44:38 -04:00
D.E. Akers 63603ada2e interpolate system commands
It may be the case that operands to `I DUZ` should not undergo
interpolation, but I'm unable to perceive the rationale. In any case,
the fix is simply to pass the argument through `castStringExplicit()`,
which is unlikely to break any existing code.

I considered adding a test, only to discover that `I DUZ` itself is not
presently being tested. I suppose this is probably to do with its being
a future feature, or else that ensuring its proper functionality across
platforms wouldn't be trivial.

In the latter case, the `echo` command is likely to be available in the
vast majority of environments, and is probably the best candidate for
testing this facet of the language.
2015-08-13 15:27:31 -04:00
Justin Meza 4154149e45 sanitize outside inputs 2015-07-29 21:53:03 -07:00
Justin Meza e97cf5296b escaping the escape character on input (thanks for reporting, @Lucki!) 2015-07-26 21:39:37 -07:00
Justin Meza e3388d5fc7 fixed string interpolation during comparison (as pointed out by @Lucki, thanks) 2015-07-19 11:22:56 -07:00
Justin Meza b0ae8def1b fix command to make documentation in README 2015-05-10 10:03:13 -07:00
Justin Meza 7046b90174 minor formatting changes; adding unit tests to Travis CI 2015-03-08 17:22:36 -04:00
Justin Meza b56bedf908 updating README; adding README.md; adding Travis CI integration 2015-03-08 17:15:13 -04:00
Justin Meza 2464d0c117 bumping version for new release 2014-12-12 15:09:31 -08:00
Justin Meza cfab7e4401 add binding to all available interfaces 2014-12-01 08:57:25 -08:00
OrdNas d95f751de5 cherry picking ord-nas's bug fix from master 2014-11-26 21:20:47 -08:00
Justin Meza e500678dae scope storage and access performance optimizations 2014-10-26 20:16:26 -07:00
Justin Meza 88c2d47e13 fix implicit declaration of close with unistd.h 2014-10-24 22:02:26 -07:00
Justin Meza ef823bc1a0 fix missing runtime array type check identified by LeartS 2014-10-24 22:00:57 -07:00
Justin Meza 5627045d83 fix induction variable update bug identified by LeartS 2014-10-23 22:57:10 -07:00
Justin Meza e8dd671a27 adding some stdlib randomizaton functions 2014-08-31 15:40:21 -07:00
Justin Meza 46590f3886 minor cleanup 2014-08-31 14:36:07 -07:00
Justin Meza 6384a4c504 fixed string interpolation in library calls 2014-05-10 00:16:14 -04:00
Justin Meza c412ec117a patched ElColmo's system command code with some minor style changes 2014-05-09 23:59:18 -04:00
Justin Meza 74b80b4aca updated some library code 2014-05-05 11:30:35 -04:00
Justin Meza 5e567c90e3 changing connection accept syntax 2014-05-05 10:07:02 -04:00
Justin Meza 4da096385e updated tests based on new library syntax 2014-05-05 02:12:29 -04:00
Justin Meza 816ffa2b5d added SOCKS library for socket I/O 2014-05-05 01:46:00 -04:00
Justin Meza 1fc16cd54a using type name instead of identifier 2014-04-26 02:01:18 -04:00
Justin Meza 731f3e7c4d added GPLv3 2014-04-21 00:08:26 -04:00
Justin Meza 33faea6c66 added some string manipulation standard library functions 2014-01-22 23:01:15 -05:00
Justin Meza 33691687d5 removed more Clang warnings 2013-12-30 12:55:39 -05:00
Justin Meza e2c479de2e removed Clang warnings 2013-12-30 12:46:49 -05:00
Justin Meza 6fea1cfb25 added support for Unicode v6.3 2013-12-19 13:36:51 -05:00
Mark J. Reed 343d661a4d use long long integers instead of ints 2013-12-19 12:51:13 -05:00
Justin J. Meza 323bb35b6d Merge pull request #10 from xiongchiamiov/future
Update project homepage a few places.
2013-11-22 18:19:17 -08:00
xiongchiamiov 5d2a84523b Update project homepage a few places.
There were two links to http://icanhaslolcode.org/ , which is now a parked
domain.  Now those appropriately go to http://lolcode.org/ .
2013-11-19 10:54:05 -08:00
Justin Meza f4ba7daf49 fixed function resolution issue pointed out by markjreed 2013-10-05 15:24:00 -04:00
Justin Meza 4e12f33afa updating README 2013-10-05 06:32:05 -04:00
Justin Meza add3956967 updating binding code 2013-10-05 06:31:56 -04:00
Justin J. Meza 610f897733 updating version 2013-03-18 13:19:43 -04:00
Justin J. Meza da61b7bcee Merge branch 'future' of github.com:justinmeza/lci into future 2013-03-18 13:17:35 -04:00
Justin Meza 4b22cae400 fixed install script 2013-03-17 19:38:33 -04:00
Justin Meza 589eaf9a21 added support for Unicode v6.2 2013-03-12 11:03:22 -04:00
Justin Meza f5ac2751bf added experimental interactive mode 2013-03-10 17:23:53 -04:00
Justin Meza 2f608d5150 reordered a couple of tests 2013-03-02 12:55:56 -05:00