646 Commits

Author SHA1 Message Date
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
Colomban Wendling
eed6e25a0e Don't duplicate the kind names and letters 2012-09-17 14:44:33 +02:00
Colomban Wendling
022524ba26 Report Python class methods as methods rather than members
This makes the Python kinds more consistent with other parsers and
allows to find Python methods when filtering on tm_tag_method_t.
2012-09-17 14:44:32 +02:00
Colomban Wendling
17396aaa99 Fix a memory leak in tm_get_current_function() 2012-09-17 14:44:32 +02:00
Colomban Wendling
f1e88ca311 Ruby parser: don't create an extra scope after "for .. in .. do"
When "do" appears as the separator after a "for", "while" or "until"
construct, don't improperly make it start its own scope too.
2012-09-13 16:34:18 +02:00
Colomban Wendling
c05f1bdd44 Remove a suspect ungetc() call in VHDL parser
This ungetc() call don't look legitimate and actually leads to lots
of warnings about ungetc() being called when another character was
already backed up.
2012-09-02 20:28:30 +02:00
Miguel Sánchez de León Peque
e469aa27e0 Update VHDL parser to display blocks in the symbols list 2012-09-02 19:42:25 +02:00
Colomban Wendling
484f6fcdef Make sure to only use as much data as it was actually read
When reading a C macro, make sure to only use as much byes we actually
got and not as much as we requested.  This should not be a problem
anymore now 61c5216 fixed a too long read, but it's safer anyway.
2012-08-25 16:02:21 +02:00
Colomban Wendling
61c5216083 Fix an off-by-one issue in C macro parsing code
Closes #3556536.
2012-08-25 15:50:09 +02:00
Matthew Brush
63249c71e8 Dedent switch block from last commit, pure noise 2012-08-03 19:07:58 -07:00
Matthew Brush
e76a35c271 Minor tweak to D "!" template parameter list parsing code
Note:
Indentation left as is so that the diff is readable, next commit contains
the indentation fix.
2012-08-03 19:07:58 -07:00
Colomban Wendling
89b7e089c4 Fix invalid use of strcpy() on overlapping memory
strcpy()'s behavior on overlapping memory is undefined, so replace such
uses with memmove().

Based on CTags r783: https://ctags.svn.sourceforge.net/svnroot/ctags@783
2012-07-31 00:33:53 +02:00
Colomban Wendling
fd40e4aa54 Mark a few things as static
Based on CTags r779: https://ctags.svn.sourceforge.net/svnroot/ctags@779
2012-07-31 00:32:53 +02:00
Colomban Wendling
3a460a2c5b Remove and unused structure member
Based on CTags r769: https://ctags.svn.sourceforge.net/svnroot/ctags@769
2012-07-31 00:31:43 +02:00
Colomban Wendling
13e5c0202a Fix Haskell parsing when a comment is the first thing inside a type
Closes #3552129.
2012-07-30 20:15:08 +02:00
Nick Treleaven
14daf925ac indent switch, add braces 2012-07-26 12:58:55 +01:00
Nick Treleaven
f0f3fc83ad Allow '!' char in D parameter lists 2012-07-09 13:31:05 +01:00
Nick Treleaven
74959b9cb9 Support MSYS=1 to enable building with MSYS; use $/ instead of DIRSEP
Defining MSYS=1 is cleaner than requiring users to define CP, RM, etc.
2012-07-04 17:13:14 +01:00
Nick Treleaven
c72dce06a5 Merge remote-tracking branch 'origin/master' into tm/tree-refactoring
Conflicts:
	makefile.win32
	src/makefile.win32
2012-07-04 12:15:53 +01:00
Nick Treleaven
e44198abb2 Parse D functions with various attributes/storage classes
Parse @attributes, pure, nothrow.
Parse return types immutable(T), shared(T), inout(T).
2012-06-08 16:40:30 +01:00
Nick Treleaven
928de3d684 Don't suppress warnings or define G_OS_WIN32 (Windows build) 2012-06-07 16:45:37 +01:00
Nick Treleaven
9f99b4f55a Merge remote-tracking branch 'origin/master' into tm/tree-refactoring 2012-06-07 16:32:32 +01:00
Nick Treleaven
18cec1fb81 Fix Windows build 2012-06-06 15:21:00 +01:00
Nick Treleaven
c37d8b4390 Do not suppress warnings (Windows makefiles)
Also do not define G_OS_WIN32.
2012-06-04 13:51:02 +01:00
Colomban Wendling
05e5f756c1 Merge branch 'master' into tm/tree-refactoring 2012-05-31 22:19:32 +02:00
Nick Treleaven
ffd3d739db Fix a missing tag on global tags merge (oops) 2012-05-27 17:20:34 +01:00
Colomban Wendling
cf3139de03 Use the same pointer type for all pointers in tm_tags_merge()
This prevents GCC from complaining about implicit casts and comparisons
between different pointer types.  It also makes the code a little less
bound at dealing with TMTags.
2012-05-25 19:47:10 +02:00
Colomban Wendling
2f94aa373e Fix incomplete copy in tm_tags_merge() that lead to crashes 2012-05-25 19:44:17 +02:00
Colomban Wendling
f0a9c42985 Update makefile.win32 build system 2012-05-08 23:01:23 +02:00
Colomban Wendling
d69a153bb4 Refactor tagmanager source files architecture
Split ctags and tagmanager sources, as follows:

tagmanager/ctags: the parsers, more or less upstream CTags;
tagmanager/mio: local MIO library copy;
tagmanager/src: actual tagmanager sources.
2012-05-08 23:01:23 +02:00
Nick Treleaven
33e1a81b4a Ignore D 'static if' tests
This prevents the parser getting confused.
2012-04-26 13:50:39 +01:00
Nick Treleaven
6e46a7bd3d Fix existing leak when a matching ignore.tags item is parsed 2012-04-25 16:13:56 +01:00
Nick Treleaven
a56373cabd Support PREFIX* in ignore.tags 2012-04-25 15:54:56 +01:00
Nick Treleaven
7c545a3094 Delete temporary error file 2012-04-25 13:48:33 +01:00