479 Commits

Author SHA1 Message Date
Colomban Wendling
387d6e1909 PHP: don't include the leading "$" in variable names 2013-04-15 19:17:57 +02:00
Colomban Wendling
b5cd5343fa PHP: fix parsing functions arguments list containing comment or strings
Instead of hand-parsing the argument list and possibly choking inside
comments, strings, heredoc, etc., use the normal token mechanism and
simply convert the tokens to a string representation as the argument
list.  This technique might perhaps lead to some missing characters in
the argument list representation in the (unlikely) case a token
appearing in the argument list is reported as a generic type for which
it is impossible to know the correct string representation, but this
could always be fixed by adding a specific token type and is anyway
less problematic than maybe breaking further parsing of the document.
2013-04-15 19:17:57 +02:00
Colomban Wendling
444745f71e Added new macro for reading last character of vString.
Import of CTags revision 719.
2013-04-15 19:17:57 +02:00
Colomban Wendling
8086129c9c PHP: parse namespaces
PHP namespaces don't work anything like a block, so the implementation
is specific and not combined with scope management.  Namespaces cannot
be nested, and they may apply either to the rest of the file (until the
next namespace declaration, if any) or to a specific block.

Namespaces applying to the rest of the file:

	namespace Foo;
	/* code in namespace Foo */
	namespace Bar\Baz;
	/* code in namespace Bar\Baz */

Namespaces applying to blocks:

	namespace Foo {
		/* code in namespace Foo */
	}
	namespace Bar\Baz {
		/* code in namespace Bar\Baz */
	}
	namespace {
		/* code in root namespace */
	}
2013-04-15 18:55:52 +02:00
Colomban Wendling
c2e4111aaf PHP: parse HereDoc and NowDoc strings 2013-04-15 18:55:14 +02:00
Colomban Wendling
258c4fa65d PHP: generate tags for local variables (disabled by default) 2013-04-15 18:54:42 +02:00
Colomban Wendling
1c3fd55818 PHP: fix generating variable tags for rvalues
Only generate tags for variable declarations without assignments inside
classes and interfaces not to get fooled by rvalues.

This prevents generation of a "$bar" tag for something like:

	$foo = $bar;

while still generating "$bar" tag for:

	class Foo {
		var $bar;
	}
2013-04-15 18:53:59 +02:00
Colomban Wendling
af47ccf98d PHP: report anonymous functions as functions rather than variables
Generate a full function tag for anonymous functions:

	$anon = function($arg1, $arg2) {
		/* ... */
	};
2013-04-15 18:53:07 +02:00
Colomban Wendling
5798f47ea0 PHP: make some arguments const 2013-04-15 18:52:14 +02:00
Colomban Wendling
bdb98f0132 PHP: fix parsing of functions returning a reference
Fix parsing of functions declarations with a leading ampersand (&),
used to make the function return a reference:

	function &foo($arg1, $arg2) {
		/* ... */
	}
2013-04-15 18:51:26 +02:00
Colomban Wendling
d283eb243c PHP: parse and report interfaces 2013-04-15 18:47:54 +02:00
Colomban Wendling
23339dd509 PHP: report class inheritance 2013-04-15 18:43:22 +02:00
Colomban Wendling
f5d315809d PHP: report visibility and implementation type
Report visibility (private/protected/public) and implementation
(abstract or not) for every tag for which it makes sense.
2013-04-15 18:42:08 +02:00
Colomban Wendling
be07870e97 Rewrite the PHP parser as a non-regex parser
Rewrite the PHP parser as a real parser, not using regexes.  This is
more complex but allows for better parsing.

Visible changes:
* Scope reporting;
* Variables inside functions are no longer reported (this is a
  deliberate choice, but can be easily changed);
* Only the PHP part is parsed (e.g. it doesn't report JavaScript
  functions anymore);
* Function arguments spanning several lines are properly reported;
* Interfaces are not yet parsed.

Otherwise the new parser should behave like the old one, at least
where it used to be right.  Parsing of more constructs and reporting
more details is planned.
2013-04-15 18:36:24 +02:00
Colomban Wendling
d453fe33fe Add support for loading Vi and CTags tag files
This allows to load tag files in the CTags format, which is compatible
with Vi format.

References:
 * http://ctags.sourceforge.net/FORMAT
 * http://ctags.sourceforge.net/ctags.html#TAG%20FILE%20FORMAT
2013-04-03 22:10:33 +02:00
Colomban Wendling
11acb59980 Add code for TMTag reference debugging
This code is disabled by default, and is enabled if the DEBUG_TAG_REFS
C preprocessor macro is defined.
2013-03-17 17:31:36 +01:00
Colomban Wendling
1646504a46 Fix build with bleeding edge GLib
CTags defines __unused__ and __printf__, which not only are reserved
identifiers, but actually are used by GNUC as arguments of the
__attribute__() extension.  This used to work because no code seeing
those definitions was trying to use them as __attribute__() argument,
but a recent change in GLib made it use it in atomic operation, which
are used by the tagmanager, which itself includes the CTags header
defining those, leading to a weird build failure -- since __unused__
expanded to an unexpected value.

To fix this, rename CTag's __ununsed__ to UNUSED and __printf__ to
PRINTF.
2013-02-13 00:22:16 +01:00
Baptiste Pierrat
d4e61bf093 Add support for Abaqus files
Support for Abaqus (.inp) files, including scintilla lexer and tag
parser.

Signed-off-by: Baptiste Pierrat <baptiste.pierrat@gmail.com>
2013-02-12 14:56:38 +01:00
Lex
bd7b56a80f Comment future fixes/additions
Note where Asciidoc features need to be supported that would
prevent code sharing with other markup parsers.
2013-01-17 15:50:40 +11:00
Lex
8294ea2c2e Add Asciidoc filetype
Add a filetype for Asciidoc with symbol parser, but not styling.
2013-01-17 15:43:24 +11:00
Lex
76aec0852a Revert incomplete Asciidoc filetype commit.
This reverts commit da78a44a1cfeb753e0d06d7175e882f508ad9788.
2013-01-17 15:27:39 +11:00
Colomban Wendling
288adaffd7 Python tag parser: fix detection of keywords followed by a tab (\t)
The Python tag parser used to require a space, and a space only, as the
character following a keyword.  Fix this so it allows any whitespace.
2012-12-06 19:41:14 +01:00
Nick Treleaven
48f7efaa68 Ignore D angle brackets e.g. Foo!(x < 2) 2012-11-27 13:35:50 +00:00
Lex
da78a44a1c Add Asciidoc filetype with symbol parser
Add an Asciidoc filetype and a basic symbol parser based on ReST.
See the FIXMEs for ReST to Asciidoc changes still to be done.
2012-11-17 19:19:27 +11:00
Nick Treleaven
e9e41ee47b Move D, Vala unique keyword aliases out of keywordTable
Instead put them in initialize*Parser().
2012-11-15 13:39:53 +00:00
Nick Treleaven
a742ff3546 Parse scope for D nested template blocks (#3582833) 2012-11-05 16:18:43 +00:00
Nick Treleaven
7d4ffb1e45 Fix parsing D 'static assert' (#3582833) 2012-11-03 16:08:35 +00:00
Colomban Wendling
2109677781 JavaScript parser: fix scope of functions nested inside methods 2012-10-28 18:55:48 +01:00
Colomban Wendling
4dafe0d8d3 JavaScript parser: properly parse regular expression literals
This prevents a regex pattern from fooling the parser if it contains
some recognized constructs, like comment or string literal starts.

Closes #2992393 and #3398636.
2012-10-26 16:59:21 +02:00
Nick Treleaven
d7e285d00e Fix parsing colons in D (#3577788) 2012-10-25 13:54:52 +01:00
Colomban Wendling
8855c146cc Fix a use of non-const variable to hold a string literal 2012-10-22 22:40:19 +02:00
Colomban Wendling
6c7f69578d Parse C++11 classed enums
Part of #3578557.
2012-10-22 22:39:04 +02:00
Colomban Wendling
f2f22d34ab Parse C++11 enums with type specifier
Part of #3578557.
2012-10-22 22:38:12 +02:00
Colomban Wendling
f04df056cd Fix parsing of C++11 final classes
Closes #3577559.
2012-10-19 21:39:38 +02:00
Colomban Wendling
b626cc93e3 ReStructuredText: fix parsing of titles containing UTF-8 characters
If a title contained multi-byte UTF-8 characters, it wasn't properly
recognized due to the title being longer (in bytes) than the underline.
So, fix the title length computation to properly count the characters,
not the bytes.

Note that this fix only handles ASCII, one-byte charsets and UTF-8, it
won't help with other multi-bytes encodings.  However, the whole parser
expects ASCII-compatible encoding anyway, and in most situations it
will be fed the Geany's UTF-8 buffer.

Closes #3578050.
2012-10-18 17:15:17 +02:00
Colomban Wendling
2c6c210c6f Fix detection of keywords when followed by a semicolon
Closes #2130612.
2012-09-30 15:46:59 +02:00
Colomban Wendling
bf233bc055 JavaScript parser: create class tag for variable with children methods
If we generated methods, properties or class children tags for a
variable, generate a class tag for the variable itself so the children
aren't orphaned.
2012-09-25 16:48:10 +02:00
Colomban Wendling
5df551b1ce JavaScript parser: fix parsing non-method properties
If a property value had more than one token, the parser choked on it
and failed to parse further properties of the object.  Fix that by
properly skipping the property's value.  If that value is a sub-object,
parse it recursively.

Closes #3470609.
2012-09-25 16:47:42 +02:00
Colomban Wendling
dc6e4f2723 JavaScript parser: lowercase "object" isn't a keyword
Closes #3036476.
2012-09-25 02:11:58 +02:00
Colomban Wendling
b9ca95c381 JavaScript parser: fix some unterminated statement corner case issues
This fixes parsing of the following unterminated statements:

	if () {
		foo = 42
	}

	if () {
		foo = new Object()
	}

	if () {
		foo = ({a:1,b:2})
	}
2012-09-25 01:31:11 +02:00
Colomban Wendling
205bab83d7 JavaScript parser: properly consume closing brace after a block in findCmdTerm() 2012-09-25 01:29:33 +02:00
Colomban Wendling
74890cc308 JavaScript parser: Simplify parseJfFile() code (no functional changes) 2012-09-24 19:51:37 +02:00
Colomban Wendling
297bca3799 JavaScript parser: Don't drop the token after an unbraced if
If an `if` haven't had braces, the code used to check itself for an
`else` after it, eating the next token if it wasn't actually an `else`.

So, drop the check for the else altogether since parseLine() handles
`else`s by calling parseIf() anyway.

This fixes constructs like:

	if (foo)
		bar();
	function baz() {
		// ...
	}

Closes #3568542.
2012-09-24 19:46:48 +02:00
Oleg Eterevsky
66888d580f In ctags JavaScript parser fix recognizing functions inside methods 2012-09-24 18:20:53 +02:00
Colomban Wendling
effc8ef86f Add proper scope for JS tags including their own context
This makes `Foo.bar = function()` properly report a function tag "bar"
with scope "Foo" rather than a function tag "Foo.bar" with no scope.

Part of #3570192.
2012-09-24 12:25:36 +02:00
Colomban Wendling
be45924f7c JavaScript parser: don't set token position information again and again
There is no need to set the token position information in the loop
searching for the initial token character, simply do that when we
finally found the token start.
2012-09-22 18:13:07 +02:00
Colomban Wendling
772509e898 ctags: fix improper use of "const" type qualifier
The external declaration of "File" in read.h (defined in read.c) was
improperly tagged as "const" for it not to be modifiable outside of
read.c.  Although it is good to protect this global variable against
improper modification, the use of "const" here makes it perfectly valid
for the compiler to assume that the fields in this structure never
changes during runtime, thus allowing it to do optimizations on this
assumption.  However, this assumption is wrong because this structure
actually gets modified by many read.c's functions, and thus possibly
lead to improper and unexpected behavior if the compiler sees a window
for optimizing fields access.

Moreover, protecting "File" as it was with the "const" type qualifier
required a hack to be able to include read.h in read.c since "const"
and non-"const" declarations conflicts.

Actually, at least the JavaScript parser did suffer of the issue,
because it calls getSourceLineNumber() macro (expanding to a direct
"File" member access) several times in one single function, making it
easy for the compilers to cache the value as an optimization.  Both GCC
and CLang showed this behavior with optimization enabled.  As a result,
the line numbers of JavaScript tags were often incorrect.
2012-09-22 17:52:29 +02:00
Colomban Wendling
877b0477c4 Set scope information for JavaScript tags
Instead of adding the scope to the tag name, properly add it as the
tag's scope.

Closes #3570192.
2012-09-22 01:27:11 +02:00
Colomban Wendling
d83bd40938 Add tm_get_current_tag() 2012-09-17 20:07:45 +02:00
Colomban Wendling
1cfa44ff62 Make tm_get_current_function() find methods too 2012-09-17 14:44:33 +02:00