Commit Graph

163 Commits

Author SHA1 Message Date
Daniel Kolesa dd90488b69 eolian: add capturing of variables/typedecls in expr eval
This will be used from validation to properly count actual
dependencies of a unit.
2018-04-20 16:10:55 +02:00
Daniel Kolesa 543902f2ba eolian: make doc ref resolution global
Doc refs no longer introduce new dependencies into files. Instead,
they're parsed globally, and any doc ref lookup is also made
globally. This allows unit based dependencies to correspond more
to what files actually really need at compile time/runtime, with
docs being irrelevant to that; it also simplifies the API.

The doc resolution API now takes Eolian_State instead of
Eolian_Unit, too.
2018-04-18 16:38:14 +02:00
Daniel Kolesa d13cfe1b83 eolian: doc ref validation cleanup 2018-04-18 16:38:14 +02:00
Daniel Kolesa 2defb32214 eolian: correct line/column number during doc reference validation
Eolian doc objects now bundle debug information necessary to
provide correct line/column numbers. It is not possible to get
this information cirectly from the text, as it's reformatted and
contains no extra whitespace or newlines beyond paragraph
separators.

Fixes T6701.
2018-04-12 15:24:15 +02:00
Daniel Kolesa e9811c6596 eolian: simplify class validation logic 2018-04-11 14:58:41 +02:00
Daniel Kolesa 710748c551 eolian: better/more robust class inheritance list replacement 2018-04-11 14:31:03 +02:00
Daniel Kolesa 474a2a319b eolian: completely scoped validation
This is much stricter than the previous behavior,
as it allows no leakage of information from the
outside to the inside.
2018-03-27 13:48:58 +02:00
Daniel Kolesa e4fd05469d eolian: validate each class with its own unit's in mind only
This is stricter (doesn't allow outer symbols to leak in).
Also needed fixing some eo files.
2018-03-27 13:27:46 +02:00
Daniel Kolesa a1ae5cd918 eolian: use new error logging for all recoverable errors 2018-03-20 17:34:51 +01:00
Daniel Kolesa bf1e3a702f eolian: event/function_get_by_name -> by_name_get 2018-03-16 14:26:15 +01:00
Daniel Kolesa 6c0180d7f8 eolian: more stringent and fine-grained validation 2018-03-16 00:14:13 +01:00
Daniel Kolesa 978ba5052d eolian: reduce the number of database traversals during validation
This significantly improves performance by not iterating certain
paths multiple times.
2018-03-15 23:25:35 +01:00
Daniel Kolesa 2d0a25c995 eolian: refactor doc ref resolution API 2018-03-14 16:51:11 +01:00
Daniel Kolesa c7fd43ad4e eolian: return Eolian_Object_Type from ref resolver
This needs only one enum and allows for better interop.
2018-03-09 15:25:36 +01:00
Daniel Kolesa 2248131295 eolian: give objects names, and reduce duplication 2018-03-08 19:47:28 +01:00
Daniel Kolesa 434b0a399d eolian: remove old class retrieval APIs 2018-03-07 13:08:49 +01:00
Daniel Kolesa 6a284e48c9 eolian: eolian_* -> eolian_state_*, Eolian -> Eolian_State 2018-02-27 16:12:35 +01:00
Mike Blumenkrantz 1f32a4fcd2 eolian: always print error and fail when name conflicts are detected 2018-02-15 13:50:56 -05:00
Daniel Kolesa 0745ec922b eolian: properly initialize warned (to avoid random parse failures) 2018-02-13 21:48:46 +01:00
Daniel Kolesa c82b30cc3c eolian: print all duplicate warnings before aborting build
Instead of aborting at the first warning, accumulate the warnings
and stop at the end of validation.
2018-02-13 10:17:41 +01:00
Daniel Kolesa 09bcf9e5fd eolian: stop build with EOLIAN_WARN_FUNC_DUPLICATES > 1 2018-02-12 18:56:38 +01:00
Daniel Kolesa b5794afa58 eolian: all dependency parsing is now deferred 2018-01-31 18:13:29 +01:00
Daniel Kolesa 5651b2e586 eolian: deferred parsing of inherits + better static checks
This change finally introduces deferred parsing of inherits to
Eolian, after a long time and many iterations. That means instead
of parsing inherits directly as part of the main file's parse pass,
they're pushed into a queue and parsed later. The validation engine
was modified to properly fill in the remaining info afterwards.

This may introduce breakages but I haven't noticed any. It also
properly unlocks cyclic dependency support in Eolian.

Additionally, this also introduces checks for duplicates in class
inherits (class Foo(Bar, Bar) is no longer possible) and it adds
stricter name checks, so you can no longer have a class Foo.Bar
and refer to it as Foo_Bar in implements. This was actually never
meant to be supported, but the check was previously broken.

@feature
2018-01-30 17:08:44 +01:00
Daniel Kolesa 7b643f6919 eolian: move impl/ctor fill to validation stage 2018-01-30 17:08:44 +01:00
Daniel Kolesa 1017f37de7 eolian: fix redefined function checks
For one, the hash has to be populated once per inheritance tree
and the skipping on already-validated funcs was interfering with
that as the function might have been validated in another
inheritance tree already.

Also, if a class appeared multiple times in an inheritance tree,
as is common with e.g. Efl.Object, it would get added into the
hash the first time and then checked against the second time,
which would result in a strange error message about the
function being redefined in its own class.

So now we prevent both cases from happening.
2018-01-18 12:49:05 +01:00
Daniel Kolesa dd2e579fec eolian: do not require unit for expr eval APIs
The necessary information is now stored directly in the expr
during database validation.

Also enable expr validation for params.
2018-01-16 16:37:52 +01:00
Daniel Kolesa b70604d018 eolian: cache enum expr in the database 2018-01-16 16:37:52 +01:00
Daniel Kolesa 54eac123c2 eolian: correctly validate function pointers 2018-01-12 19:14:13 +01:00
Daniel Kolesa 19c16b671e eolian: type_typedecl_get doesn't need a unit 2018-01-12 18:05:13 +01:00
Daniel Kolesa 707ed05d58 eolian: do not require unit for type_class_get 2018-01-12 18:05:13 +01:00
Daniel Kolesa db41734954 eolian: store typedecl/class in type 2018-01-12 18:05:13 +01:00
Daniel Kolesa efb419fd74 eolian: prevent unnecessary hash table allocs 2017-12-22 15:36:31 +01:00
Daniel Kolesa 7da6675c34 eolian: perform partial class validation every time
This makes sure that duplicate method/part/etc checks are done on
every database update, removing the need for clunky toplevel
checks and improving reliability. It also sacrifices some
performance but it shouldn't be too bad (if a class is already
validated, some checks are avoided to speed things up).
2017-12-22 15:36:31 +01:00
Daniel Kolesa e1bcd61bdf eolian: move inherit type checking to validation 2017-12-22 15:36:31 +01:00
Daniel Kolesa 18e18ca74c eolian: remove remaining global state (+ modify APIs accordingly) 2017-12-15 17:11:11 +01:00
Daniel Kolesa 9a5c3cfbe2 eolian: remove internal state struct (rely on external Eolian state) 2017-12-06 15:07:31 +01:00
Daniel Kolesa a25327c62e eolian: move constants to temporary state 2017-12-06 15:07:31 +01:00
Daniel Kolesa 21db23f702 eolian: move global vars to temporary state 2017-12-06 15:07:31 +01:00
Daniel Kolesa 7491f9353f eolian: move enums to temporary state 2017-12-06 15:07:31 +01:00
Daniel Kolesa 51ec796497 eolian: move structs to temporary state 2017-12-06 15:07:31 +01:00
Daniel Kolesa 8428eaa663 eolian: store aliases in temporary state 2017-12-06 15:07:31 +01:00
Daniel Kolesa 2a0f873c84 eolian: pass unit within validation engine 2017-12-05 16:41:42 +01:00
Lauro Moura 0931696a4f eolian: Add inarray and inlist 2017-12-04 15:47:48 -03:00
Jean-Philippe Andre aef05c26d6 eolian: Warn less on duplicate beta APIs
The check was only done on one of the two functions, resulting in some
unwanted warnings.

EOLIAN_WARN_FUNC_DUPLICATES=1 will show non-beta warnings.
EOLIAN_WARN_FUNC_DUPLICATES=2 will still show all warnings.
2017-11-30 10:48:24 +09:00
Daniel Kolesa 0dbbb18171 eolian: disallow ptr() on things that are already pointer-like
This disallows deeply nested pointers, you can only explicitly
ptr() on types that are strictly value types.

For a few cases where it was necessary to override this behavior,
you can use legacy(ptr(x)) as a temporary measure.
2017-11-03 15:30:10 +01:00
Daniel Kolesa cf63573e73 eolian: only allow reference (ownable) types in containers 2017-11-02 13:51:02 +01:00
Daniel Kolesa f851fa511e eolian: add part validation (including dup check with funcs) 2017-11-01 13:19:33 +01:00
Jean-Philippe Andre c1d21cef89 eolian: Add some color to those warning messages
Note: This is not using eina_log, not entirely sure why, but this
doesn't prevent us from adding some color.
2017-10-31 14:52:34 +09:00
Jean-Philippe Andre 1adb93b3e5 eolian: Skip @beta APIs for duplicate warnings
No warnings:
export EOLIAN_WARN_FUNC_DUPLICATES=0

No beta warnings:
export EOLIAN_WARN_FUNC_DUPLICATES=1

All warnings including beta:
export EOLIAN_WARN_FUNC_DUPLICATES=2

EOLIAN_WARN_FUNC_DUPLICATES is not an API and may change in the future
as we improve the tool :)
2017-10-31 14:52:34 +09:00
Daniel Kolesa 4f8a9b50f4 eolian: make inherits_get return a list of classes, not strings
Most of the time you need to retrieve the class from the string
anyway, so remove this relic of old Eolian and gain some small
performance benefits and extra convenience.

Subtly breaks API but everything should be updated.
2017-10-25 16:25:41 +02:00
Daniel Kolesa c46f9bec2d eolian: enable duplicate validation but only warn for now
Use the EOLIAN_WARN_FUNC_DUPLICATES environment variable to enable
those warnings.
2017-10-25 13:03:20 +02:00
Daniel Kolesa bd90fff392 eolian: only check for validation where really necessary 2017-10-24 23:41:59 +02:00
Daniel Kolesa 88083b0f14 eolian: check for inheritance tree function conflicts
Now a class cannot define a method/property of some name if there
already is something of the same name within the inheritance tree.
2017-10-24 23:39:14 +02:00
Daniel Kolesa 05b395be47 eolian: validate classes in a recursive manner
This allows for proper order of validation which will improve our
performance when also validating for name duplicates.
2017-10-24 23:21:24 +02:00
Daniel Kolesa 903fd9065c eolian: keep track of which objects are validated 2017-10-24 17:49:21 +02:00
Daniel Kolesa 7c7e5ec423 eolian: validate inner types of complex types
This makes sure the inner types are all correctly defined and
that freefuncs are actually correctly filled.
2017-09-28 23:22:05 +02:00
Daniel Kolesa 9009d3dae4 eolian: add any_value_ptr
Because pointer Eina_Values and value Eina_Values have slightly
different semantics (when it comes to resource management) it's
better to split them.
2017-09-22 20:25:31 +02:00
Daniel Kolesa 3d8081d085 eolian: rename generic_value to any_value 2017-09-22 20:16:06 +02:00
Daniel Kolesa a6e5caba10 eolian: remove leftover code 2017-09-22 18:08:36 +02:00
Daniel Kolesa 1577c576e6 eolian: remove static_array and terminated_array
These types are of questionable value and the API was not entirely
thought out - remove for now, and if a legitimate use is found
later, they may be readded (with a better API), but typically it
seems best to redesign the bad APIs around safe containers...
2017-09-22 18:01:15 +02:00
Daniel Kolesa 4bae2a7385 eolian: merge REGULAR and COMPLEX types 2017-09-22 17:46:02 +02:00
Daniel Kolesa fdd27cadf8 eo: make more freefuncs implicit 2017-09-22 16:17:19 +02:00
Daniel Kolesa 21213802e4 eolian: switch validation to new ownership system 2017-09-15 16:37:26 +02:00
Daniel Kolesa 518ca72d06 eolian: default free funcs for builtin types 2017-09-14 15:53:30 +02:00
Daniel Kolesa 59347d4c4b eolian: include terminatable checks in ownable check 2017-09-14 00:28:32 +02:00
Daniel Kolesa 8ff2bf35fe eolian: inherit freefunc between types/typedecls 2017-09-14 00:12:46 +02:00
Daniel Kolesa 2a9be1f5be eolian: move terminated_array typecheck to validate pass 2017-09-13 23:58:47 +02:00
Daniel Kolesa a0adca9cb9 eolian: move ownable checks to validation stage 2017-09-13 23:58:47 +02:00
Lauro Moura 1634c14169 eolian: function pointers
First steps toward explicit function pointer support in eolian.

To declare a function pointer type, use the following syntax, similar to
a regular eolian method declaration.

function FunctionName {
  params {
    ...
  }
  return: Return type
}
2017-06-18 12:09:22 -03:00
Daniel Kolesa a5e66b3421 eolian: doc token ref resolver now takes unit 2017-05-30 17:15:54 +02:00
Daniel Kolesa 81a1d9659a eolian: type_class_get takes unit 2017-05-30 17:15:54 +02:00
Daniel Kolesa c234b5ee69 eolian: expr eval APIs now take units 2017-05-30 17:15:54 +02:00
Daniel Kolesa 9699d074bc eolian: pass unit to all_classes_get 2017-05-30 17:15:53 +02:00
Daniel Kolesa 5411dba596 eolian: add implement validation (currently for docs) 2017-01-19 15:09:07 +01:00
Daniel Kolesa 95181f2d36 eolian: move base function doc API into implements
This allows us to unify retrieval of docs for both regular and
overridden funcs without having two separate APIs. It's currently
missing validation and docgen is still not adjusted properly for
it either, but at least there's this. Enables retrieval of docs
for overridden funcs by default as well.
2017-01-19 15:09:07 +01:00
Daniel Kolesa 3dfb7a6ba8 eolian: enable typechecked expression validation
This code was formerly disabled, but it's safe now.
2016-12-15 13:31:58 +01:00
Daniel Kolesa 246288fff7 eolian: forgotten free() (leaks memory otherwise) 2016-12-07 14:06:02 +01:00
Daniel Kolesa 5fa81d9fab eolian: switch reference validation to new tokenizer 2016-12-07 13:56:35 +01:00
Daniel Kolesa 8002b3b24e eolian: remove parsing of pointers and the corresponding APIs
Everything should be done via the new ptr() system now.
2016-11-10 16:20:19 +01:00
Daniel Kolesa 82ef73ca18 eolian: remove type silencing stuff entirely
this was useful during transition, but not anymore
2016-10-25 18:02:23 +02:00
Daniel Kolesa ab2e608239 eolian: add support for static and terminated arrays
Adds two new type types, STATIC_ARRAY and TERMINATED_ARRAY. Static arrays are
only allowed as struct members right now - they translate to regular C static
arrays (allowing them elsewhere wouldn't be good, as C isn't very good at
working with the size information). Terminated arrays are basically sequences
of data terminated at the end. The base type of static arrays can be any type
that is not marked ref (explicit ref may get allowed later). The base type of
terminated arrays has the same restriction plus that it has to be either
implicitly reference type (i.e. translating to pointer in C), integer type
or a character. In case of ref types, the terminator is NULL. In case of
integer types, the terminator is a zero. In case of character types, the
terminator is also a zero (null terminator like C strings).

@feature
2016-06-30 16:59:21 +01:00
Tom Hacohen cfd7b57006 Eolian: Turn on strict type checking.
Thanks to q66 for the code.
I'm stealing credit here because:
1. I'm lazy.
2. He's lazy and doesn't deserve it.
2016-04-19 17:15:28 +01:00
Daniel Kolesa e061d49aac eolian: completely clean up the type system 2016-03-03 18:58:11 +00:00
Daniel Kolesa 4c4fbfae0b eolian: remove most of the old type APIs 2016-03-03 18:58:11 +00:00
Daniel Kolesa 4e40b60f06 eolian: remove retrieval funcs for type-style enums/aliases/structs 2016-03-03 18:58:11 +00:00
Daniel Kolesa eee5cc4fdc eolian: re-enable strict validation 2016-02-18 10:14:41 +00:00
Cedric BAIL 56a21ab5f2 Revert "eolian: strict validation for EFL (errors by default)"
This reverts commit 21a2a8007d.

Please run make check from time to time.
2016-02-17 14:37:42 -08:00
Daniel Kolesa 21a2a8007d eolian: strict validation for EFL (errors by default) 2016-02-17 13:00:41 +00:00
Daniel Kolesa 2998da56e3 eolian: verbose type warnings for EFL by default 2016-02-16 15:13:02 +00:00
Daniel Kolesa 30bc1d285b eolian: allow silencing of type errors in validation
This allows generators to silence type errors in validation in order
to reduce duplicate error messages when generating multiple files.
Also adjusted the C generator to only emit type errors when generating
Eo header files.

@feature
2016-02-10 16:05:07 +00:00
Daniel Kolesa b3867ce395 eolian: turn "undefined type" into its own EOLIAN_TYPE 2015-11-19 14:05:16 +00:00
Daniel Kolesa 26d0053a0f eolian: do not treat @since specially in validation (not needed) 2015-08-06 17:04:06 +01:00
Daniel Kolesa b2bfd64f26 eolian: different error for validating @since 2015-07-31 15:55:24 +01:00
Daniel Kolesa e805dcd370 eolian: enable the new doc validator
This will make Eolian error when the input documentation
is in a wrong format.
2015-07-08 15:51:29 +01:00
Daniel Kolesa 69cccd043a eolian: print more detailed location info for doc validation 2015-07-08 14:47:09 +01:00
Daniel Kolesa b5141e6291 eolian: correct documentation ref validation (disabled for now) 2015-07-08 13:39:46 +01:00
Daniel Kolesa 70b7043731 eolian: initial work on doc syntax validation (disabled for now) 2015-07-07 15:21:45 +01:00
Daniel Kolesa 660e23fd75 eolian: add new __undefined_type builtin to silence warnings 2015-06-10 16:56:37 +01:00
Daniel Kolesa 6b91b1bd12 eolian: allow keys/values in property get/set
Sometimes it is necessary to specify a different set of values for a
getter or a setter. This commit allows such specializations. This also
renders @const_get and @const_set useless (soon to be removed).

To function correctly, this required adjustment of several public APIs
as well as deprecation of eolian_function_parameter_get_by_name.

This function was not used in any generator and was pretty much
useless in the first place, so it was removed.

@fix
2015-05-20 17:42:44 +01:00
Daniel Kolesa ed58165b50 eolian: butts 2015-05-12 16:25:52 +01:00