Upstream changes
This commit is contained in:
parent
7bde7c7197
commit
a5ddb5cd66
@ -134,7 +134,8 @@ typedef enum {
|
||||
GTK_SOURCE_CONTEXT_ENGINE_ERROR_INVALID_WHERE,
|
||||
GTK_SOURCE_CONTEXT_ENGINE_ERROR_INVALID_START_REF,
|
||||
GTK_SOURCE_CONTEXT_ENGINE_ERROR_INVALID_REGEX,
|
||||
GTK_SOURCE_CONTEXT_ENGINE_ERROR_INVALID_STYLE
|
||||
GTK_SOURCE_CONTEXT_ENGINE_ERROR_INVALID_STYLE,
|
||||
GTK_SOURCE_CONTEXT_ENGINE_ERROR_BAD_FILE
|
||||
} GtkSourceContextEngineError;
|
||||
|
||||
typedef enum {
|
||||
@ -2255,13 +2256,9 @@ gtk_source_context_engine_attach_buffer (GtkSourceEngine *engine,
|
||||
main_definition = LOOKUP_DEFINITION (ce->priv->ctx_data, root_id);
|
||||
g_free (root_id);
|
||||
|
||||
if (main_definition == NULL)
|
||||
{
|
||||
g_warning (_("Missing main language "
|
||||
"definition (id = \"%s\".)"),
|
||||
ENGINE_ID (ce));
|
||||
return;
|
||||
}
|
||||
/* If we don't abort here, we will crash later (#485661). But it should
|
||||
* never happen, _gtk_source_context_data_finish_parse checks main context. */
|
||||
g_assert (main_definition != NULL);
|
||||
|
||||
ce->priv->root_context = context_new (NULL, main_definition, NULL, NULL, FALSE);
|
||||
ce->priv->root_segment = create_segment (ce, NULL, ce->priv->root_context, 0, 0, TRUE, NULL);
|
||||
@ -6183,8 +6180,11 @@ _gtk_source_context_data_finish_parse (GtkSourceContextData *ctx_data,
|
||||
GError **error)
|
||||
{
|
||||
struct ResolveRefData data;
|
||||
gchar *root_id;
|
||||
ContextDefinition *main_definition;
|
||||
|
||||
g_return_val_if_fail (ctx_data != NULL, FALSE);
|
||||
g_return_val_if_fail (ctx_data->lang != NULL, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
while (overrides != NULL)
|
||||
@ -6209,10 +6209,23 @@ _gtk_source_context_data_finish_parse (GtkSourceContextData *ctx_data,
|
||||
g_propagate_error (error, data.error);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
|
||||
/* Engine will crash without main context, check it here (#485661) */
|
||||
root_id = g_strdup_printf ("%s:%s", ctx_data->lang->priv->id, ctx_data->lang->priv->id);
|
||||
main_definition = LOOKUP_DEFINITION (ctx_data, root_id);
|
||||
g_free (root_id);
|
||||
|
||||
if (main_definition == NULL)
|
||||
{
|
||||
return TRUE;
|
||||
g_set_error (error, GTK_SOURCE_CONTEXT_ENGINE_ERROR,
|
||||
GTK_SOURCE_CONTEXT_ENGINE_ERROR_BAD_FILE,
|
||||
_("Missing main language "
|
||||
"definition (id = \"%s\".)"),
|
||||
ctx_data->lang->priv->id);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -58,11 +58,11 @@ struct _GtkSourceStyleSchemeManagerClass
|
||||
|
||||
GType gtk_source_style_scheme_manager_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkSourceStyleSchemeManager
|
||||
*gtk_source_style_scheme_manager_new (void);
|
||||
GtkSourceStyleSchemeManager *
|
||||
gtk_source_style_scheme_manager_new (void);
|
||||
|
||||
GtkSourceStyleSchemeManager
|
||||
*gtk_source_style_scheme_manager_get_default (void);
|
||||
GtkSourceStyleSchemeManager *
|
||||
gtk_source_style_scheme_manager_get_default (void);
|
||||
|
||||
void gtk_source_style_scheme_manager_set_search_path (GtkSourceStyleSchemeManager *manager,
|
||||
gchar **path);
|
||||
|
@ -126,6 +126,7 @@
|
||||
<keyword>out</keyword>
|
||||
<keyword>override</keyword>
|
||||
<keyword>params</keyword>
|
||||
<keyword>partial</keyword>
|
||||
<keyword>private</keyword>
|
||||
<keyword>protected</keyword>
|
||||
<keyword>public</keyword>
|
||||
|
@ -25,7 +25,7 @@
|
||||
-->
|
||||
<language id="js" _name="Javascript" version="2.0" _section="Scripts">
|
||||
<metadata>
|
||||
<property name="mimetypes">application/x-javascript;text/x-javascript;text/javascript;text/x-js</property>
|
||||
<property name="mimetypes">application/javascript;application/x-javascript;text/x-javascript;text/javascript;text/x-js</property>
|
||||
<property name="globs">*.js</property>
|
||||
<property name="line-comment-start">//</property>
|
||||
<property name="block-comment-start">/*</property>
|
||||
|
@ -101,6 +101,22 @@
|
||||
<match>\\[a-zA-Z]+</match>
|
||||
</context>
|
||||
|
||||
<context id="in-math">
|
||||
<include>
|
||||
<context ref="common-commands"/>
|
||||
<context ref="specials-symbol"/>
|
||||
<context ref="command"/>
|
||||
</include>
|
||||
</context>
|
||||
|
||||
<context id="in-inline-math">
|
||||
<include>
|
||||
<context ref="common-commands"/>
|
||||
<context ref="specials-symbol"/>
|
||||
<context ref="command"/>
|
||||
</include>
|
||||
</context>
|
||||
|
||||
<context id="latex">
|
||||
<include>
|
||||
|
||||
@ -120,27 +136,43 @@
|
||||
</include>
|
||||
</context>
|
||||
|
||||
<context id="math" style-ref="math">
|
||||
<context id="math-1" style-ref="math">
|
||||
<start>\$\$</start>
|
||||
<end>\$\$</end>
|
||||
<include>
|
||||
<context sub-pattern="0" where="start" style-ref="math-bound"/>
|
||||
<context sub-pattern="0" where="end" style-ref="math-bound"/>
|
||||
<context ref="common-commands"/>
|
||||
<context ref="specials-symbol"/>
|
||||
<context ref="command"/>
|
||||
<context ref="in-math"/>
|
||||
</include>
|
||||
</context>
|
||||
|
||||
<context id="inline-math" style-ref="inline-math">
|
||||
<context id="math-2" style-ref="math">
|
||||
<start>\\\[</start>
|
||||
<end>\\\]</end>
|
||||
<include>
|
||||
<context sub-pattern="0" where="start" style-ref="math-bound"/>
|
||||
<context sub-pattern="0" where="end" style-ref="math-bound"/>
|
||||
<context ref="in-math"/>
|
||||
</include>
|
||||
</context>
|
||||
|
||||
<context id="inline-math-1" style-ref="inline-math">
|
||||
<start>\$</start>
|
||||
<end>\$</end>
|
||||
<include>
|
||||
<context sub-pattern="0" where="start" style-ref="math-bound"/>
|
||||
<context sub-pattern="0" where="end" style-ref="math-bound"/>
|
||||
<context ref="common-commands"/>
|
||||
<context ref="specials-symbol"/>
|
||||
<context ref="command"/>
|
||||
<context ref="in-inline-math"/>
|
||||
</include>
|
||||
</context>
|
||||
|
||||
<context id="inline-math-2" style-ref="inline-math">
|
||||
<start>\\\(</start>
|
||||
<end>\\\)</end>
|
||||
<include>
|
||||
<context sub-pattern="0" where="start" style-ref="math-bound"/>
|
||||
<context sub-pattern="0" where="end" style-ref="math-bound"/>
|
||||
<context ref="in-inline-math"/>
|
||||
</include>
|
||||
</context>
|
||||
|
||||
|
@ -41,6 +41,11 @@
|
||||
<include>
|
||||
<context ref="def:escape"/>
|
||||
<context ref="def:line-continue"/>
|
||||
<context ref="c:printf"/>
|
||||
<context ref="python:format"/>
|
||||
<context id="mnemonic" style-ref="def:special-char">
|
||||
<match>[&_][a-zA-Z]</match>
|
||||
</context>
|
||||
</include>
|
||||
</context>
|
||||
<context id="format" style-ref="comment" end-at-line-end="true">
|
||||
|
Loading…
x
Reference in New Issue
Block a user