summaryrefslogtreecommitdiff
path: root/stdscan.c
AgeCommit message (Collapse)AuthorFilesLines
2013-11-27stdscan: Rework curly brace parsing routinesJin Kyu Song1-64/+46
As recommended by the community, a comma-separated decorators ({k1,z}) and nested braces ({{k1},{z}}) are dropped out. So only standard syntax is supported from now. This rework made source code neat and easy to maintain. Most of the codes for handling corner cases are removed. Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-08-06AVX-512: Add support for parsing bracesJin Kyu Song1-4/+90
AVX-512 introduced new syntax using braces for decorators. Opmask, broadcat, rounding control use this new syntax. http://software.intel.com/sites/default/files/319433-015.pdf Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31stdscan.c: use TOKEN_EOS and string helpersCyrill Gorcunov1-6/+5
Also tab/space cleanup Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31Various tab/space/comment cleanupCyrill Gorcunov1-61/+63
No change on binary level Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31stdscan: switch to stdscan_get/set routinesCyrill Gorcunov1-1/+11
Instead of manipulating stdscan buffer pointer directly we switch to a routine interface. This allow us to unify stdscan access: ie caller should "talk" to stdscan via stdscan_get/set routines. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-06-28Add copyright headers to the *.c/*.h files in the main directoryH. Peter Anvin1-0/+33
Add copyright headers to the *.c/*.h files in the main directory. For files where I'm sure enough that we have all the approvals, I have given them the 2-BSD license, the others have been given the "LGPL for now" license header. Most of them can probably be changed after auditing. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-06-21ctype.h: wrapper ctype functions with a cast to (unsigned char)H. Peter Anvin1-1/+1
ctype functions take an *int*, which the user is expected to have taken the input character from getc() and friends, or taken a character and cast it to (unsigned char). We don't care about EOF (-1), so use macros that cast to (unsigned char) for us.
2008-06-11Use an explicit table for tolower() to avoid a function callH. Peter Anvin1-1/+1
On some platforms, tolower() is implemented as a function call, in order to handle locale support. We never change locales, so can the result of tolower() into a table, so we don't have to sit through the function call every time. ~1.3% overall performance improvement on a macro-heavy benchmark under Linux x86-64.
2008-06-09Make strings a first-class token type; defer evaluationH. Peter Anvin1-6/+2
Make strings a proper, first-class token type, instead of relying on the "TOKEN_NUM with tv_charptr" hack. Only convert a string to a number if requested in an expression context; this also makes it possible to actually issue a warning when it overflows.
2008-06-04Fix memory management issues with expanded %includeH. Peter Anvin1-9/+8
Ownership of the filename string was a bit fuzzy, with the result that we were freeing it even though it was retained for use by __FILE__. Clean up a number of other memory management issues with the new quoting code, and change the stdscan implementation to one pass over the string.
2008-06-01qstring: backquoted strings seem to work now...H. Peter Anvin1-12/+17
Hopefully backquoted strings should work correctly now.
2008-05-30stdscan.c: clarify commentH. Peter Anvin1-1/+1
There is a reason rn_warn isn't checked in this particular case...
2007-10-22Support binary and octal floating-pointH. Peter Anvin1-1/+1
For consistency, support binary and octal floating-point, and accept a "0d" or "0t" prefix for decimal floating-point. However, we do not accept a binary exponent (p) for a decimal mantissa, or vice versa.
2007-10-22More consistent handling of radix lettersH. Peter Anvin1-7/+8
Allow any radix letter from the set [bydtoqhx] to be used either "Intel-style" (0...x) or "C-style" (0x...). In Intel style, the leading 0 remains optional as long as the first digit is in the range 0-9. As a consequence, allow the prefix "0h" for hexadecimal floating point.
2007-10-19Allow $-prefixed hexadecimal FP as an alternative to 0xH. Peter Anvin1-1/+1
Since we allow the prefix $ instead of 0x for integer constants, do the same for floating point. No suffix support at this time; we may want to consider if that would be appropriate.
2007-10-19Formatting: kill off "stealth whitespace"H. Peter Anvin1-1/+0
"Stealth whitespace" makes it harder to read diffs, and just generally cause unwanted weirdness. Do a source-wide pass to get rid of it.
2007-10-19Don't confuse suffixed hexadecimal with floating-pointH. Peter Anvin1-3/+20
1e30 is a floating-point constant, but 1e30h is not. The scanner won't know that until it sees the "h", so make sure we keep enough state to be able to distinguish "1e30" (a possible hex constant) from "1.e30", "1e+30" or "1.0" (unabiguously floating-point.)
2007-10-19Allow underscores in numbers; better detection of FPH. Peter Anvin1-25/+35
- Allow underscores as group separators in numbers, for example: 0x1234_5678 is now a legal number. The underscore is just ignored, it adds no meaning. - Recognize dotless floating-point numbers, such as "1e30". This entails distinguishing hexadecimal numbers in the scanner, since e.g. 0x1e30 is a perfectly legitimate hex constant.
2007-10-11More "bool" fixesH. Peter Anvin1-1/+1
A few more variables passed as pointers which are now defined as bool *.
2007-10-11Additional uses of bool and enumH. Peter Anvin1-1/+1
Proper use of bool and enum makes code easier to debug. Do more of it. In particular, we really should stomp out any residual uses of magic constants that aren't enums or, in some cases, even #defines.
2007-10-10Use the compiler-provided booleans if available, otherwise emulateH. Peter Anvin1-2/+2
Both C and C++ have "bool", "true" and "false" in lower case; C requires <stdbool.h> for this, in C++ it is an inherent type built into the compiler. Use those instead of the old macros; emulate with a simple typedef enum if unavailable.
2007-10-02Portability fixesH. Peter Anvin1-0/+2
Concentrate compiler dependencies to compiler.h; make sure compiler.h is included first in every .c file (since some prototypes may depend on the presence of feature request macros.) Actually use the conditional inclusion of various functions (totally broken in previous releases.)
2007-09-18Slightly optimize the interface to nasm_token_hash()H. Peter Anvin1-5/+1
Instead of returning -1 from nasm_token_hash, set tv->t_type to TOKEN_ID and return TOKEN_ID, since that's what stdscan.c wants to do with it anyway. This allows us to simply tailcall nasm_token_hash().
2007-09-18Support C99-style hexadecimal floating point.H. Peter Anvin1-1/+3
Add support for C99-style hexadecimal floating point. The format is 0x <hexadecimal mantissa> p <binary exponent>. 0x1.0e+1 thus is the same as 2.0.
2007-08-31Minor cleanup; remove duplication of names.cH. Peter Anvin1-3/+3
2007-08-30Finishing touches on perfect hash tokenizer; actually turn the thing onH. Peter Anvin1-0/+201
Finish the perfect hash tokenizer, and actually enable it. Move stdscan() et al to a separate file, since it's not needed in any of the clients of nasmlib other than nasm itself. Run make alldeps.