Yep. It's a simplified regexp (as much as possible). The main thing is
not to complicate the explanation with complicated regexps, etc (since
the source of an article is big by itself) -- this is an education
language, not a production.
Though, you can give me your regexp you think fits better for education
article ;) Only of course it won't complicate the things too much.
Dmitry.
On 01.09.2011 19:19, gaz Heyes wrote:
Isn't this a bit flawed?
function isVariable(expression) {
return /^([a-z-A-Z0-9_$+*/\-])+$/.test(expression);
}
isVariable('/*');//true? should be false
isVariable('*');//true? should be false
isVariable('-');//true?should be false
isVariable('+');//true?should be false
isVariable('\\u0061');//should be true
isVariable('ϩ');//should be true
Or did I just scan the code and not realize what actually is going on?
On 31 August 2011 16:08, Dmitry A. Soshnikov
<[email protected] <mailto:[email protected]>> wrote:
The next part of implementing an interpreter is out.
"Essentials of interpretation" Lesson 5. Simple user-defined
functions.
https://github.com/DmitrySoshnikov/Essentials-of-interpretation/blob/master/src/lesson-5.js
Dmitry.
--
To view archived discussions from the original JSMentors Mailman
list: http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]
<mailto:jsmentors%[email protected]>
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]