summaryrefslogtreecommitdiff
path: root/modules/parsers
Commit message (Collapse)AuthorAgeFilesLines
* Fix #201: explicitly ignore [warning] directive and treat as warning.Peter Johnson2010-05-165-0/+21
| | | | svn path=/trunk/yasm/; revision=2323
* Support all unary operators in directive expressions.Peter Johnson2010-05-161-45/+22
| | | | svn path=/trunk/yasm/; revision=2322
* Update yasm_parsers(7) now that GAS preprocessor support is fairly mature.Peter Johnson2010-02-131-5/+5
| | | | svn path=/trunk/yasm/; revision=2286
* Add support for gas preprocessor macro directives.Peter Johnson2010-02-133-0/+33
| | | | | | | | | It doesn't yet support the full set of macro types gas supports, but can handle a lot of common cases. Contributed by: Alexei Svitkine svn path=/trunk/yasm/; revision=2285
* Add .intel_syntax and .gas_syntax support to GAS parser.Peter Johnson2010-01-1910-0/+236
| | | | | | | | Uses the NASM parser for the .intel_syntax parsing heavy lifting. Contributed by: Alexei Svitkine svn path=/trunk/yasm/; revision=2279
* Add nasm-parser-struct.h to SOURCES.Peter Johnson2010-01-191-0/+1
| | | | svn path=/trunk/yasm/; revision=2278
* Nasm parser: Add some very basic MASM-ish syntax handling, along the linesPeter Johnson2010-01-195-4/+80
| | | | | | | | | | | of the TASM "mode". These code paths aren't used yet; they will be used for GAS .intel_syntax handling. Contributed by: Alexei Svitkine svn path=/trunk/yasm/; revision=2277
* Split yasm_parser_nasm structure out to separate header.Peter Johnson2010-01-192-61/+96
| | | | | | | | | This is needed so that other parsers can get access to this structure without naming conflicts. Contributed by: Alexei Svitkine svn path=/trunk/yasm/; revision=2276
* Update autoconf/automake scripts.Peter Johnson2010-01-071-1/+1
| | | | | | | | Also remove ltmain.sh as we no longer use libtool. Patch submitted by: Roumen Petrov <bugtrack@roumenpetrov.info> svn path=/trunk/yasm/; revision=2269
* Now that the gas preproc supports .rept, remove it from the gas parser.Peter Johnson2010-01-034-269/+1
| | | | svn path=/trunk/yasm/; revision=2266
* GAS preproc: Fix line number for .rept without matching .endr error.Peter Johnson2010-01-032-1/+3
| | | | | | | | The line number reported for the error is that of the .rept directive. Contributed by: Alexei Svitkine <alexei.svitkine@gmail.com> svn path=/trunk/yasm/; revision=2265
* Improve the gas preprocessor and re-add it as default for gas parser.Peter Johnson2010-01-035-14/+17
| | | | | | | | | | | | | | Contributed by: Alexei Svitkine <alexei.svitkine@gmail.com> Summary of changes: - Correct line numbers will now be reported for warnings and errors when using the GAS preprocessor - GAS preprocessor will now replace defined (e.g. via .set) variables by their values in lines returned to the parser - GAS preprocessor will now handle multi-line comments correctly - GAS preprocessor will now handle nested .rept directives correctly svn path=/trunk/yasm/; revision=2260
* Implement some linemap changes required for the GAS preprocessor.Peter Johnson2010-01-032-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Contributed by: Alexei Svitkine <alexei.svitkine@gmail.com> - yasm_linemap_set() now takes virtual_line as a parameter, instead of always using linemap->current. If 0 is passed for the virtual_line, then linemap->current is used, as before. This is because linemap->current was only incremented by the parser (and never decremented), so the preprocessor was not able to set mappings during the preprocessing phase (whereas with these changes, it now does). Additionally, setting a mapping for a line number will now delete any existing mappings for line numbers equal or greater to that line number. This allows the code to correctly handle the case when the preprocessor first sets mappings from pre-pp lines to post-pp lines, and later those mappings getting superseded by .line directives in the original source. This change also required making a change to yasm_linemap_lookup() to set *file_line to 0 when line is 0 (i.e. preventing line 0 - which means "don't display line number in output" - from getting mapped). svn path=/trunk/yasm/; revision=2259
* Revert gas parser default to raw preproc until gas tests pass with the gasPeter Johnson2009-12-281-2/+2
| | | | | | preproc. svn path=/trunk/yasm/; revision=2250
* Default to gas preproc for gas parser.Peter Johnson2009-12-261-1/+1
| | | | svn path=/trunk/yasm/; revision=2244
* Add initial gas preprocessor, contributed by Alexei Svitkine.Peter Johnson2009-12-231-1/+2
| | | | | | | | | | Support for include directive amongst other major key pieces. Does not currently support macros. Fixes #79. Contributed by: Alexei Svitkine <alexei.svitkine@gmail.com> svn path=/trunk/yasm/; revision=2243
* Fix #78 further: Support C++ style // comments.Peter Johnson2009-09-123-1/+4
| | | | svn path=/trunk/yasm/; revision=2232
* tasm parser: Support "not" keyword.Peter Johnson2009-04-173-0/+6
| | | | | | Requested by: Rugxulo <rugxulo@gmail.com> svn path=/trunk/yasm/; revision=2196
* Fix referencing of local label from line that defines nonlocal label.Peter Johnson2009-03-254-10/+27
| | | | | | Reported by: Brian Gladman svn path=/trunk/yasm/; revision=2190
* gas parser: Allow segment register prefixes before instructions.Peter Johnson2009-01-024-11/+376
| | | | svn path=/trunk/yasm/; revision=2169
* gas parser: Allow equ's to be named the same as instructions.Peter Johnson2009-01-022-2/+5
| | | | svn path=/trunk/yasm/; revision=2168
* Remove long-obsolete "debug" flag from internal parser structures.Peter Johnson2009-01-024-10/+0
| | | | svn path=/trunk/yasm/; revision=2167
* Allow @ signs in identifiers in win32/win64 only.Peter Johnson2009-01-021-0/+10
| | | | | | | | | | | | | | In ELF, @ is used to indicate special relocations. Fixes #164. Reported by: Gregory McGarry on yasm-devel@ Testcase by: Gregory McGarry We don't allow identifiers to start with @; doing so conflicts with use of e.g. "@function" in some directives. Need to look into what GAS does. svn path=/trunk/yasm/; revision=2166
* Gas parser: Move instruction/prefix lookup from tokenizer to parser.Peter Johnson2009-01-023-118/+98
| | | | | | | | | | | | | | | Use the single token of lookahead to detect the label case. This is significantly cleaner as it removes the special-casing of labels in the tokenizer (so there is just a single identifier rule) and removes the INSTDIR parser state (as this was only used to prevent instruction lookup within other locations). Also, ID and LABEL now provide the string length to the parser. We needed to do this for ID due to parse_check_insnprefix() needing the length, so both were folded in for consistency. svn path=/trunk/yasm/; revision=2164
* gas-parse.c: Fix double-free on error.Peter Johnson2008-12-241-1/+0
| | | | svn path=/trunk/yasm/; revision=2163
* Fix #161: Don't require 0d/0e/0f/0t prefix on floating point numbers.Peter Johnson2008-10-304-1/+395
| | | | | | While this is not mentioned in the GAS documentation, GAS doesn't require it. svn path=/trunk/yasm/; revision=2158
* Remove directory EXTRA_DIST; it seems to be making distcheck on ctn die.Peter Johnson2008-10-081-1/+0
| | | | svn path=/trunk/yasm/; revision=2140
* Use yasm functions yasm__strcasecmp and nasm_strdup instead of relying onPeter Johnson2008-10-081-11/+11
| | | | | | | | | | | platform to have them. Also, instead of using snprintf, preallocate and then use sprintf. This also avoids the while() reallocation loop. Reported by: Brian Gladman svn path=/trunk/yasm/; revision=2139
* Don't use tasm_compatible_mode in nasm parser (use local var instead).Peter Johnson2008-10-074-30/+40
| | | | | | Fix a few warnings while here. svn path=/trunk/yasm/; revision=2134
* Add core TASM syntax support.Peter Johnson2008-10-0749-39/+1192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Contributed by: Samuel Thibault <samuel.thibault@ens-lyon.org> It is built on top of the NASM parser and preproc, with the following notable extensions for TASM syntax: - case insensitive symbols and filenames, - support for segment and size of labels, which permits to avoid giving them on each memory dereference, - support for data reservation (i.e. e.g. "var dd ?"), - support for multiples (i.e. e.g. "var dd 1 dup 10"), - little endian string integer constants, - additional expression operators: shl, shr, and, or, low, high, - additional offset keyword, - additional fword and df, - support for doubled quotes within quotes, - support for array-like and structure-like notations: t[eax] and [var].field, - support for tasm directives: macro, rept, irp, locals, proc, struc, segment, assume. Notes: - Almost all extensions are only effective when tasm_compatible_mode is set, so we should have very reduced possible breakage. - Because the "and" keyword can be an expression operator and an instruction name, the data pseudo-instructions explicitly switch the lexer state to INSTRUCTION state to fix the ambiguity. - In gen_x86_insn.py, several instructions (namely lds and lea) now take relaxed memory sizes. The reason is that in the case of tasm, the size of the actual pointed data is passed up to there, and thus any type of data should be accepted. With all of this, loadlin can be compiled by yasm with quite reduced modifications. A new TASM-like frontend is also included. svn path=/trunk/yasm/; revision=2130
* Nasm lexer: Don't read past end of passed string.Peter Johnson2008-09-301-47/+38
| | | | | | | | | | This was because the re2c-generated code always reads the next character prior to user code being executed. Instead, check for the \0 marker prior to entering the re2c code. Retain the re2c check just for sanity. Reported by: Samuel Thibault (on yasm-devel@) svn path=/trunk/yasm/; revision=2122
* Add cmake build infrastructure.Peter Johnson2008-05-223-0/+34
| | | | | | | | | | | | | | | | | Not default nor even distributed in the .tar.gz, the cmake build allows for loadable yasm plugins by building libyasm as a shared library. Example plugins are in the plugins/ directory, and may be loaded into a cmake-built yasm using the -N command line option (non-cmake builds will not have this option). Tested only on Linux so far, but should be relatively painless to port to Windows thanks to the use of cmake rather than libtool to create shared libraries. The only modification to the main source tree is some conditional-compiled additions to yasm.c. svn path=/trunk/yasm/; revision=2098
* Split NASM preprocessor standard macro set between various modules.Peter Johnson2008-05-094-1/+130
| | | | | | | | | | | | | | | | | | | | Standard macro sets are looked up based on parser and preprocessor keyword from individual modules. The "standard" NASM parser macros now reside in the NASM parser, so when the GAS parser is used with the NASM preprocessor, the NASM-specific macros are no longer defined. Object-format specific macros are now individually defined by each object formatm module. This allows for the object formats to be independent of the NASM preprocessor module and yields a small optimization benefit as unused object format macros don't need to be skipped over. Also add GAS macro equivalents for the Win64 SEH more complex directives [1]. [1] Requested by Brian Gladman <brg@gladman.plus.com> svn path=/trunk/yasm/; revision=2082
* Allow registers as GAS directive parameters.Peter Johnson2008-05-091-0/+5
| | | | | | This is required for the win64 SEH directives. svn path=/trunk/yasm/; revision=2081
* Fix GAS handling of NASM preproc %line.Peter Johnson2008-04-291-1/+13
| | | | | | Reported by: Brian Gladman svn path=/trunk/yasm/; revision=2078
* Support use of NASM preprocessor with GAS parser.Peter Johnson2008-04-254-19/+156
| | | | | | | | Note: this combination is obviously not supported by any other assembler. Requested by: Brian Gladman <brg@gladman.plus.com> svn path=/trunk/yasm/; revision=2076
* Allow underscores in the middle of binary, octal, and hex constants.Peter Johnson2008-04-124-9/+53
| | | | | | | This makes things like 00_11_22_33h okay. Allow 0X as well as 0x in directives (already allowed for normal case). svn path=/trunk/yasm/; revision=2063
* Add complete Intel Advanced Vector Extensions (AVX) support.Peter Johnson2008-04-114-0/+53
| | | | | | | | | | | | A full testcase for NASM mode based on the AVX programming reference is included. GAS mode should work, but is untested at present. V-prefix aliases are present for all supported instructions to allow easy use of the VEX prefix version without significant code modifications. All comparison and other pseudo-ops are included. svn path=/trunk/yasm/; revision=2051
* Fix #136: Unbreak ..@ non-local-label mechanism.Peter Johnson2008-03-276-28/+79
| | | | | | | | Add testcase for this. Also fix $-prefixed labels to match non-$-prefixed label behavior (this has been broken for a very long time). svn path=/trunk/yasm/; revision=2045
* Fix #134: Allow '@' as the first character of an identifier, like NASM does.Peter Johnson2008-02-151-1/+1
| | | | svn path=/trunk/yasm/; revision=2038
* Enable use of sym@FOO constructs in GAS parser.Peter Johnson2008-02-093-13/+34
| | | | | | | | | | To do this, restructure how special symbols are handled between the parser and object format. Instead of creating special symbols with the right names, instead have the parser call the object format to see if a match is found into the special symbols, which are no longer stored in the symbol table. svn path=/trunk/yasm/; revision=2035
* Make jmp with seg:off equ behave the same as NASM.Peter Johnson2008-01-191-45/+69
| | | | | | | | | | | | | | | | | | | | | | Formerly: foo equ 1:2 jmp foo would result in a far jump. Now, an explicit "far" is required: jmp far foo to generate a far jump. In addition, the direct use of seg:off in immediates and effective addresses will result in an error; the use of EQU'ed seg:off values is still legal (and will still result in just the offset). This behavior is more sane and also matches NASM behavior. Thus: foo equ 1:2 mov ax, foo ; okay, just 2 mov ax, [foo] ; okay, just 2 mov ax, 1:2 ; illegal mov ax, [1:2] ; illegal svn path=/trunk/yasm/; revision=2028
* Check for 0-termination character rather than newline.Peter Johnson2007-12-071-3/+3
| | | | svn path=/trunk/yasm/; revision=2023
* Fix #122: Allow standalone prefixes.Peter Johnson2007-12-044-4/+19
| | | | | | Implementation copied from gas parser. svn path=/trunk/yasm/; revision=2021
* Fix #125: Improve reporting of operand and expression syntax errors.Peter Johnson2007-12-044-15/+99
| | | | | | | | | | Now instead of the generic "expression syntax error", more informative error messages such as the following are reported: - unexpected `:' after instruction - expected expression after `%' - expected operand, got `%' svn path=/trunk/yasm/; revision=2020
* Fix #123: Be explicit that errors are such by printing "error:" at beginningPeter Johnson2007-12-045-18/+18
| | | | | | of error messages. svn path=/trunk/yasm/; revision=2019
* Fix #127: Allow use of 0X in addition to 0x for hex constants.Peter Johnson2007-12-044-2/+14
| | | | svn path=/trunk/yasm/; revision=2017
* Change preprocessor interface from block-oriented to line-oriented.Peter Johnson2007-11-037-85/+72
| | | | | | | | | | This will make certain types of parser-preprocessor synchronization easier for upcoming feature enhancements. Due to additional complexity in GAS (rept), internally GAS converts lines back into blocks. svn path=/trunk/yasm/; revision=2007
* Check correct variable for badly parsed expression.Peter Johnson2007-11-021-1/+1
| | | | svn path=/trunk/yasm/; revision=2006
* Follow NASM after all in only turning off default RIP-rel for FS and GS,Peter Johnson2007-09-201-4/+1
| | | | | | | not all segment registers. FS and GS are the only ones which can have a segment base != 0. svn path=/trunk/yasm/; revision=1971