Comments (4)
Good spot.
The parser for object creator was a little slapdash. I'm pretty sure I wrote that code wrapped under a blanket while fighting off covid. Which also explains why the tests aren't thorough enough.
I'm going to merge the changes I have currently and will rewrite the object creator parser for a new release.
from murex.
Looks like you've uncovered not one, but two bugs in the parser.
null
bareword parsed as string:
» %{ "foo": null }
{
"foo": "null"
}
variables are tokenised for is-null
parameters
» $foo = "bar"
» is-null foo
foo: defined and not null
» is-null $foo
bar: undefined or null
Both of these are trivially fixable so I'll get an update pushed to develop
shortly
from murex.
@tiymat pushed a fix to develop
. I'll probably put this live in the next day or two because it's a low impact change.
from murex.
In testing the develop
version (5.3.7000) I noticed a potentially-related issue.
In JSON objects constructed with %{}
syntax, is-null
seems to interpret empty strings as nulls, contradicting the documentation which says "Zero length strings [...] are all not null."
tmp » cat test.mx
#!/usr/bin/murex
%{ "foo": "" } -> formap key value {
if { is-null value } then {
out "value is null"
} else {
out "value is NOT null"
}
}
tmp » ./test.mx
value is null
Edit: I guess the issue isn't with is-null
itself but rather how the JSON object is being parsed/constructed.
~ » %{ "foo": '' }
{
"foo": null
}
from murex.
Related Issues (20)
- Optionals should be enabled/disabled via compile time flags
- Improvements to index and element HOT 1
- Murex fails to compile on AUR HOT 3
- broken links on landing page HOT 2
- ':>' operator HOT 1
- Cursor flickering on backspace while having tab completion active on some terminal emulators HOT 10
- Ternary operator
- lambda support
- Create a "deprecated" section
- Autocomplete to suggest values after flags have been added HOT 3
- Disable walk history while in `[f9]` preview mode
- readline: some hotkeys no longer update terminal with readline state
- Variables sometimes return base64 encoded values
- Error on windows: Error creating table preview_command: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work HOT 9
- Website: Opening "config" builtins page from left menu breaks site HOT 2
- rewrite object creator parser
- Zero-length environment variables reported as null HOT 1
- Murex bug: database is locked (5) (SQLITE_BUSY): '/home/me/.murex_modules/cache.db' HOT 1
- murex panic: runtime error: index out of range [0] with length 0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from murex.