/* lexer.c generated by valac 0.56.19, the Vala compiler
 * generated from lexer.vala, do not modify */

/* SPDX-License-Identifier: GPL-3.0-or-later*/

#include <glib-object.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "graphs.h"
#include <gobject/gvaluecollector.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define GRAPHS_MATH_PARSER_TYPE_LEXER (graphs_math_parser_lexer_get_type ())
#define GRAPHS_MATH_PARSER_LEXER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GRAPHS_MATH_PARSER_TYPE_LEXER, GraphsMathParserLexer))
#define GRAPHS_MATH_PARSER_LEXER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRAPHS_MATH_PARSER_TYPE_LEXER, GraphsMathParserLexerClass))
#define GRAPHS_MATH_PARSER_IS_LEXER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GRAPHS_MATH_PARSER_TYPE_LEXER))
#define GRAPHS_MATH_PARSER_IS_LEXER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRAPHS_MATH_PARSER_TYPE_LEXER))
#define GRAPHS_MATH_PARSER_LEXER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRAPHS_MATH_PARSER_TYPE_LEXER, GraphsMathParserLexerClass))

typedef struct _GraphsMathParserLexer GraphsMathParserLexer;
typedef struct _GraphsMathParserLexerClass GraphsMathParserLexerClass;
typedef struct _GraphsMathParserLexerPrivate GraphsMathParserLexerPrivate;
typedef enum  {
	GRAPHS_MATH_PARSER_TOKEN_TYPE_NUMBER,
	GRAPHS_MATH_PARSER_TOKEN_TYPE_IDENT,
	GRAPHS_MATH_PARSER_TOKEN_TYPE_PLUS,
	GRAPHS_MATH_PARSER_TOKEN_TYPE_MINUS,
	GRAPHS_MATH_PARSER_TOKEN_TYPE_STAR,
	GRAPHS_MATH_PARSER_TOKEN_TYPE_SLASH,
	GRAPHS_MATH_PARSER_TOKEN_TYPE_CARET,
	GRAPHS_MATH_PARSER_TOKEN_TYPE_FACT,
	GRAPHS_MATH_PARSER_TOKEN_TYPE_SUPERSCRIPT,
	GRAPHS_MATH_PARSER_TOKEN_TYPE_LPAREN,
	GRAPHS_MATH_PARSER_TOKEN_TYPE_RPAREN,
	GRAPHS_MATH_PARSER_TOKEN_TYPE_END
} GraphsMathParserTokenType;

#define GRAPHS_MATH_PARSER_TYPE_TOKEN_TYPE (graphs_math_parser_token_type_get_type ())
typedef enum  {
	GRAPHS_MATH_PARSER_IDENT_PI,
	GRAPHS_MATH_PARSER_IDENT_E,
	GRAPHS_MATH_PARSER_IDENT_INF,
	GRAPHS_MATH_PARSER_IDENT_SIN,
	GRAPHS_MATH_PARSER_IDENT_COS,
	GRAPHS_MATH_PARSER_IDENT_TAN,
	GRAPHS_MATH_PARSER_IDENT_COT,
	GRAPHS_MATH_PARSER_IDENT_SEC,
	GRAPHS_MATH_PARSER_IDENT_CSC,
	GRAPHS_MATH_PARSER_IDENT_SIND,
	GRAPHS_MATH_PARSER_IDENT_COSD,
	GRAPHS_MATH_PARSER_IDENT_TAND,
	GRAPHS_MATH_PARSER_IDENT_COTD,
	GRAPHS_MATH_PARSER_IDENT_SECD,
	GRAPHS_MATH_PARSER_IDENT_CSCD,
	GRAPHS_MATH_PARSER_IDENT_ASIN,
	GRAPHS_MATH_PARSER_IDENT_ACOS,
	GRAPHS_MATH_PARSER_IDENT_ATAN,
	GRAPHS_MATH_PARSER_IDENT_ACOT,
	GRAPHS_MATH_PARSER_IDENT_ASEC,
	GRAPHS_MATH_PARSER_IDENT_ACSC,
	GRAPHS_MATH_PARSER_IDENT_ASIND,
	GRAPHS_MATH_PARSER_IDENT_ACOSD,
	GRAPHS_MATH_PARSER_IDENT_ATAND,
	GRAPHS_MATH_PARSER_IDENT_ACOTD,
	GRAPHS_MATH_PARSER_IDENT_ASECD,
	GRAPHS_MATH_PARSER_IDENT_ACSCD,
	GRAPHS_MATH_PARSER_IDENT_LOG,
	GRAPHS_MATH_PARSER_IDENT_LOG2,
	GRAPHS_MATH_PARSER_IDENT_LOG10,
	GRAPHS_MATH_PARSER_IDENT_SQRT,
	GRAPHS_MATH_PARSER_IDENT_EXP,
	GRAPHS_MATH_PARSER_IDENT_ABS,
	GRAPHS_MATH_PARSER_IDENT_CUSTOM
} GraphsMathParserIdent;

#define GRAPHS_MATH_PARSER_TYPE_IDENT (graphs_math_parser_ident_get_type ())
typedef struct _GraphsMathParserParamSpecLexer GraphsMathParserParamSpecLexer;

struct _GraphsMathParserLexer {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GraphsMathParserLexerPrivate * priv;
	GraphsMathParserTokenType current_type;
	GraphsMathParserIdent current_ident;
	gdouble current_val;
};

struct _GraphsMathParserLexerClass {
	GTypeClass parent_class;
	void (*finalize) (GraphsMathParserLexer *self);
};

struct _GraphsMathParserLexerPrivate {
	const gchar* src;
	gunichar c;
	gunichar decimal_separator;
	gboolean allow_custom_ident;
	gint current_start;
	gint current_end;
};

struct _GraphsMathParserParamSpecLexer {
	GParamSpec parent_instance;
};

static gint GraphsMathParserLexer_private_offset;
static gpointer graphs_math_parser_lexer_parent_class = NULL;

VALA_EXTERN gpointer graphs_math_parser_lexer_ref (gpointer instance);
VALA_EXTERN void graphs_math_parser_lexer_unref (gpointer instance);
VALA_EXTERN GParamSpec* graphs_math_parser_param_spec_lexer (const gchar* name,
                                                 const gchar* nick,
                                                 const gchar* blurb,
                                                 GType object_type,
                                                 GParamFlags flags);
VALA_EXTERN void graphs_math_parser_value_set_lexer (GValue* value,
                                         gpointer v_object);
VALA_EXTERN void graphs_math_parser_value_take_lexer (GValue* value,
                                          gpointer v_object);
VALA_EXTERN gpointer graphs_math_parser_value_get_lexer (const GValue* value);
VALA_EXTERN GType graphs_math_parser_lexer_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType graphs_math_parser_token_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType graphs_math_parser_ident_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GraphsMathParserLexer* graphs_math_parser_lexer_new (gboolean allow_custom_ident);
VALA_EXTERN GraphsMathParserLexer* graphs_math_parser_lexer_construct (GType object_type,
                                                           gboolean allow_custom_ident);
VALA_EXTERN void graphs_math_parser_lexer_start_lexing (GraphsMathParserLexer* self,
                                            const gchar* src,
                                            gunichar decimal_separator,
                                            GError** error);
VALA_EXTERN void graphs_math_parser_lexer_next (GraphsMathParserLexer* self,
                                    GError** error);
static void graphs_math_parser_lexer_handle_number (GraphsMathParserLexer* self,
                                             GError** error);
static void graphs_math_parser_lexer_handle_identifier (GraphsMathParserLexer* self,
                                                 GError** error);
VALA_EXTERN gdouble graphs_math_parser_ipow (gdouble bas,
                                 gint exp);
static inline void graphs_math_parser_lexer_fail_identifier (GraphsMathParserLexer* self,
                                               gint* state,
                                               GError** error);
VALA_EXTERN gboolean graphs_math_parser_is_superscript (gunichar c);
VALA_EXTERN void graphs_math_parser_lexer_expect_end (GraphsMathParserLexer* self,
                                          GError** error);
VALA_EXTERN void graphs_math_parser_lexer_expect (GraphsMathParserLexer* self,
                                      GraphsMathParserTokenType t,
                                      GError** error);
VALA_EXTERN gchar* graphs_math_parser_lexer_get_current_token_as_string (GraphsMathParserLexer* self);
static void graphs_math_parser_lexer_finalize (GraphsMathParserLexer * obj);
static GType graphs_math_parser_lexer_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
graphs_math_parser_lexer_get_instance_private (GraphsMathParserLexer* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsMathParserLexer_private_offset);
}

GraphsMathParserLexer*
graphs_math_parser_lexer_construct (GType object_type,
                                    gboolean allow_custom_ident)
{
	GraphsMathParserLexer* self = NULL;
	self = (GraphsMathParserLexer*) g_type_create_instance (object_type);
	self->priv->allow_custom_ident = allow_custom_ident;
	return self;
}

GraphsMathParserLexer*
graphs_math_parser_lexer_new (gboolean allow_custom_ident)
{
	return graphs_math_parser_lexer_construct (GRAPHS_MATH_PARSER_TYPE_LEXER, allow_custom_ident);
}

void
graphs_math_parser_lexer_start_lexing (GraphsMathParserLexer* self,
                                       const gchar* src,
                                       gunichar decimal_separator,
                                       GError** error)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (src != NULL);
	self->priv->src = src;
	self->priv->current_end = 0;
	self->priv->decimal_separator = decimal_separator;
	graphs_math_parser_lexer_next (self, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
}

static gboolean
string_get_next_char (const gchar* self,
                      gint* index,
                      gunichar* c)
{
	gunichar _vala_c = 0U;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_vala_c = g_utf8_get_char (((gchar*) self) + (*index));
	if (_vala_c != ((gunichar) 0)) {
		gchar* _tmp0_;
		_tmp0_ = g_utf8_next_char (((gchar*) self) + (*index));
		*index = (gint) (_tmp0_ - ((gchar*) self));
		result = TRUE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	} else {
		result = FALSE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	}
}

void
graphs_math_parser_lexer_next (GraphsMathParserLexer* self,
                               GError** error)
{
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp11_ = FALSE;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	self->priv->current_start = self->priv->current_end;
	{
		gboolean _tmp0_ = FALSE;
		_tmp0_ = TRUE;
		while (TRUE) {
			const gchar* _tmp1_;
			gunichar _tmp2_ = 0U;
			gboolean _tmp3_;
			if (!_tmp0_) {
				if (!g_unichar_isspace (self->priv->c)) {
					break;
				}
			}
			_tmp0_ = FALSE;
			_tmp1_ = self->priv->src;
			_tmp3_ = string_get_next_char (_tmp1_, &self->priv->current_end, &_tmp2_);
			self->priv->c = _tmp2_;
			if (_tmp3_) {
				continue;
			}
			if (self->priv->current_end == 0) {
				GError* _tmp4_;
				_tmp4_ = g_error_new_literal (GRAPHS_MATH_ERROR, GRAPHS_MATH_ERROR_SYNTAX, "empty expression");
				_inner_error0_ = _tmp4_;
				if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
					g_propagate_error (error, _inner_error0_);
					return;
				} else {
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
					g_clear_error (&_inner_error0_);
					return;
				}
			}
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_END;
			return;
		}
	}
	if (g_unichar_isdigit (self->priv->c)) {
		_tmp5_ = TRUE;
	} else {
		_tmp5_ = self->priv->c == self->priv->decimal_separator;
	}
	if (_tmp5_) {
		graphs_math_parser_lexer_handle_number (self, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
				g_propagate_error (error, _inner_error0_);
				return;
			} else {
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return;
			}
		}
		return;
	}
	if (g_unichar_isalpha (self->priv->c)) {
		_tmp6_ = TRUE;
	} else {
		_tmp6_ = self->priv->c == 960U;
	}
	if (_tmp6_) {
		graphs_math_parser_lexer_handle_identifier (self, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
				g_propagate_error (error, _inner_error0_);
				return;
			} else {
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return;
			}
		}
		return;
	}
	if (self->priv->c == ((gunichar) '*')) {
		gint tmp_idx = 0;
		const gchar* _tmp7_;
		gunichar _tmp8_ = 0U;
		gboolean _tmp9_;
		tmp_idx = self->priv->current_end;
		_tmp7_ = self->priv->src;
		_tmp9_ = string_get_next_char (_tmp7_, &tmp_idx, &_tmp8_);
		self->priv->c = _tmp8_;
		if (!_tmp9_) {
			GError* _tmp10_;
			_tmp10_ = g_error_new_literal (GRAPHS_MATH_ERROR, GRAPHS_MATH_ERROR_SYNTAX, "expected token");
			_inner_error0_ = _tmp10_;
			if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
				g_propagate_error (error, _inner_error0_);
				return;
			} else {
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return;
			}
		}
		if (self->priv->c == ((gunichar) '*')) {
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_CARET;
			self->priv->current_end = tmp_idx;
		} else {
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_STAR;
		}
		return;
	}
	if (self->priv->c == ((gunichar) '+')) {
		_tmp11_ = TRUE;
	} else {
		_tmp11_ = self->priv->c == ((gunichar) '-');
	}
	if (_tmp11_) {
		gboolean plus = FALSE;
		gint tmp_idx = 0;
		GraphsMathParserTokenType _tmp17_ = 0;
		plus = self->priv->c == ((gunichar) '+');
		tmp_idx = self->priv->current_end;
		while (TRUE) {
			{
				gboolean _tmp12_ = FALSE;
				_tmp12_ = TRUE;
				while (TRUE) {
					const gchar* _tmp13_;
					gunichar _tmp14_ = 0U;
					gboolean _tmp15_;
					if (!_tmp12_) {
						if (!g_unichar_isspace (self->priv->c)) {
							break;
						}
					}
					_tmp12_ = FALSE;
					_tmp13_ = self->priv->src;
					_tmp15_ = string_get_next_char (_tmp13_, &tmp_idx, &_tmp14_);
					self->priv->c = _tmp14_;
					if (!_tmp15_) {
						GError* _tmp16_;
						_tmp16_ = g_error_new_literal (GRAPHS_MATH_ERROR, GRAPHS_MATH_ERROR_SYNTAX, "expected token");
						_inner_error0_ = _tmp16_;
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
			}
			if (self->priv->c == ((gunichar) '-')) {
				plus = !plus;
			} else {
				if (self->priv->c != ((gunichar) '+')) {
					break;
				}
			}
			self->priv->current_end = tmp_idx;
		}
		if (plus) {
			_tmp17_ = GRAPHS_MATH_PARSER_TOKEN_TYPE_PLUS;
		} else {
			_tmp17_ = GRAPHS_MATH_PARSER_TOKEN_TYPE_MINUS;
		}
		self->current_type = _tmp17_;
		return;
	}
	switch (self->priv->c) {
		case '/':
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_SLASH;
			break;
		}
		case '^':
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_CARET;
			break;
		}
		case '!':
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_FACT;
			break;
		}
		case '(':
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_LPAREN;
			break;
		}
		case ')':
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_RPAREN;
			break;
		}
		case 8304U:
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_SUPERSCRIPT;
			self->current_val = (gdouble) 0;
			break;
		}
		case 185U:
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_SUPERSCRIPT;
			self->current_val = (gdouble) 1;
			break;
		}
		case 178U:
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_SUPERSCRIPT;
			self->current_val = (gdouble) 2;
			break;
		}
		case 179U:
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_SUPERSCRIPT;
			self->current_val = (gdouble) 3;
			break;
		}
		case 8308U:
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_SUPERSCRIPT;
			self->current_val = (gdouble) 4;
			break;
		}
		case 8309U:
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_SUPERSCRIPT;
			self->current_val = (gdouble) 5;
			break;
		}
		case 8310U:
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_SUPERSCRIPT;
			self->current_val = (gdouble) 6;
			break;
		}
		case 8311U:
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_SUPERSCRIPT;
			self->current_val = (gdouble) 7;
			break;
		}
		case 8312U:
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_SUPERSCRIPT;
			self->current_val = (gdouble) 8;
			break;
		}
		case 8313U:
		{
			self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_SUPERSCRIPT;
			self->current_val = (gdouble) 9;
			break;
		}
		default:
		{
			GError* _tmp18_;
			_tmp18_ = g_error_new_literal (GRAPHS_MATH_ERROR, GRAPHS_MATH_ERROR_SYNTAX, "invalid token");
			_inner_error0_ = _tmp18_;
			if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
				g_propagate_error (error, _inner_error0_);
				return;
			} else {
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return;
			}
		}
	}
}

static void
graphs_math_parser_lexer_handle_number (GraphsMathParserLexer* self,
                                        GError** error)
{
	gboolean seen_dot = FALSE;
	gboolean last_is_dot = FALSE;
	gboolean seen_exp = FALSE;
	gint idx = 0;
	gint tmp_idx = 0;
	glong int_part = 0L;
	glong frac_part = 0L;
	gint frac_digits = 0;
	gint exp = 0;
	gint exp_sign = 0;
	gint digit = 0;
	gdouble val = 0.0;
	gboolean _tmp18_ = FALSE;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	seen_dot = FALSE;
	last_is_dot = FALSE;
	seen_exp = FALSE;
	idx = self->priv->current_end;
	tmp_idx = idx;
	int_part = (glong) 0;
	frac_part = (glong) 0;
	frac_digits = 0;
	exp = 0;
	exp_sign = 1;
	while (TRUE) {
		const gchar* _tmp14_;
		gunichar _tmp15_ = 0U;
		gboolean _tmp16_;
		digit = g_unichar_digit_value (self->priv->c);
		if (digit >= 0) {
			if (seen_exp) {
				exp = (exp * 10) + digit;
			} else {
				if (seen_dot) {
					gint _tmp0_;
					frac_part = (frac_part * 10) + digit;
					_tmp0_ = frac_digits;
					frac_digits = _tmp0_ + 1;
				} else {
					int_part = (int_part * 10) + digit;
				}
			}
			last_is_dot = FALSE;
		} else {
			if (self->priv->c == self->priv->decimal_separator) {
				gboolean _tmp1_ = FALSE;
				if (seen_dot) {
					_tmp1_ = TRUE;
				} else {
					_tmp1_ = seen_exp;
				}
				if (_tmp1_) {
					GError* _tmp2_;
					_tmp2_ = g_error_new_literal (GRAPHS_MATH_ERROR, GRAPHS_MATH_ERROR_SYNTAX, "invalid number");
					_inner_error0_ = _tmp2_;
					if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
						g_propagate_error (error, _inner_error0_);
						return;
					} else {
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return;
					}
				}
				seen_dot = TRUE;
				last_is_dot = TRUE;
			} else {
				gboolean _tmp3_ = FALSE;
				gboolean _tmp4_ = FALSE;
				if (self->priv->c == ((gunichar) 'e')) {
					_tmp4_ = TRUE;
				} else {
					_tmp4_ = self->priv->c == ((gunichar) 'E');
				}
				if (_tmp4_) {
					_tmp3_ = !seen_exp;
				} else {
					_tmp3_ = FALSE;
				}
				if (_tmp3_) {
					const gchar* _tmp5_;
					gunichar _tmp6_ = 0U;
					gboolean _tmp7_;
					gboolean _tmp8_ = FALSE;
					_tmp5_ = self->priv->src;
					_tmp7_ = string_get_next_char (_tmp5_, &tmp_idx, &_tmp6_);
					self->priv->c = _tmp6_;
					if (!_tmp7_) {
						break;
					}
					if (self->priv->c == ((gunichar) '+')) {
						_tmp8_ = TRUE;
					} else {
						_tmp8_ = self->priv->c == ((gunichar) '-');
					}
					if (_tmp8_) {
						const gchar* _tmp9_;
						gunichar _tmp10_ = 0U;
						gboolean _tmp11_;
						if (self->priv->c == ((gunichar) '-')) {
							exp_sign = -1;
						}
						_tmp9_ = self->priv->src;
						_tmp11_ = string_get_next_char (_tmp9_, &tmp_idx, &_tmp10_);
						self->priv->c = _tmp10_;
						if (!_tmp11_) {
							break;
						}
					}
					if (!g_unichar_isdigit (self->priv->c)) {
						break;
					}
					seen_exp = TRUE;
					last_is_dot = FALSE;
					idx = tmp_idx;
					continue;
				} else {
					gboolean _tmp12_ = FALSE;
					gboolean _tmp13_ = FALSE;
					if (self->priv->c == ((gunichar) '.')) {
						_tmp13_ = TRUE;
					} else {
						_tmp13_ = self->priv->c == ((gunichar) ',');
					}
					if (_tmp13_) {
						_tmp12_ = TRUE;
					} else {
						_tmp12_ = g_unichar_isspace (self->priv->c);
					}
					if (!_tmp12_) {
						break;
					}
				}
			}
		}
		idx = tmp_idx;
		_tmp14_ = self->priv->src;
		_tmp16_ = string_get_next_char (_tmp14_, &tmp_idx, &_tmp15_);
		self->priv->c = _tmp15_;
		if (!_tmp16_) {
			break;
		}
	}
	if (last_is_dot) {
		GError* _tmp17_;
		_tmp17_ = g_error_new_literal (GRAPHS_MATH_ERROR, GRAPHS_MATH_ERROR_SYNTAX, "invalid number");
		_inner_error0_ = _tmp17_;
		if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	val = (gdouble) int_part;
	if (seen_dot) {
		val += frac_part / graphs_math_parser_ipow (10., frac_digits);
	}
	if (seen_exp) {
		_tmp18_ = exp != 0;
	} else {
		_tmp18_ = FALSE;
	}
	if (_tmp18_) {
		gint e = 0;
		gdouble _tmp19_ = 0.0;
		gboolean _tmp20_ = FALSE;
		e = exp_sign * exp;
		if (e > 0) {
			_tmp20_ = e <= 308;
		} else {
			_tmp20_ = FALSE;
		}
		if (_tmp20_) {
			_tmp19_ = graphs_math_parser_ipow (10., e);
		} else {
			_tmp19_ = pow (10., (gdouble) e);
		}
		val *= _tmp19_;
	}
	self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_NUMBER;
	self->current_val = val;
	self->priv->current_end = idx;
}

static inline void
graphs_math_parser_lexer_fail_identifier (GraphsMathParserLexer* self,
                                          gint* state,
                                          GError** error)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	if (!self->priv->allow_custom_ident) {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (GRAPHS_MATH_ERROR, GRAPHS_MATH_ERROR_UNKNOWN_FUNCTION, "invalid identifier");
		_inner_error0_ = _tmp0_;
		if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	self->current_ident = GRAPHS_MATH_PARSER_IDENT_CUSTOM;
	*state = 200;
}

static void
graphs_math_parser_lexer_handle_identifier (GraphsMathParserLexer* self,
                                            GError** error)
{
	gint state = 0;
	gint tmp_idx = 0;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	self->current_type = GRAPHS_MATH_PARSER_TOKEN_TYPE_IDENT;
	self->current_ident = GRAPHS_MATH_PARSER_IDENT_CUSTOM;
	state = 0;
	tmp_idx = self->priv->current_end;
	self->priv->c = g_unichar_tolower (self->priv->c);
	while (TRUE) {
		gboolean _tmp0_ = FALSE;
		gboolean _tmp1_ = FALSE;
		const gchar* _tmp2_;
		gunichar _tmp3_ = 0U;
		gboolean _tmp4_;
		switch (state) {
			case 0:
			{
				switch (self->priv->c) {
					case 960U:
					{
						{
							self->current_ident = GRAPHS_MATH_PARSER_IDENT_PI;
							state = 200;
							break;
						}
					}
					case 'p':
					{
						state = 1;
						break;
					}
					case 'e':
					{
						state = 10;
						break;
					}
					case 'i':
					{
						state = 15;
						break;
					}
					case 's':
					{
						state = 20;
						break;
					}
					case 'c':
					{
						state = 40;
						break;
					}
					case 't':
					{
						state = 60;
						break;
					}
					case 'l':
					{
						state = 70;
						break;
					}
					case 'a':
					{
						state = 80;
						break;
					}
					default:
					{
						graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
								g_propagate_error (error, _inner_error0_);
								return;
							} else {
								g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
								g_clear_error (&_inner_error0_);
								return;
							}
						}
						break;
					}
				}
				break;
			}
			case 1:
			{
				if (self->priv->c == ((gunichar) 'i')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_PI;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 10:
			{
				if (self->priv->c == ((gunichar) 'x')) {
					state = 11;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 11:
			{
				if (self->priv->c == ((gunichar) 'p')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_EXP;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 15:
			{
				if (self->priv->c == ((gunichar) 'n')) {
					state = 16;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 16:
			{
				if (self->priv->c == ((gunichar) 'f')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_INF;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 20:
			{
				if (self->priv->c == ((gunichar) 'i')) {
					state = 21;
				} else {
					if (self->priv->c == ((gunichar) 'e')) {
						state = 25;
					} else {
						if (self->priv->c == ((gunichar) 'q')) {
							state = 28;
						} else {
							graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
							if (G_UNLIKELY (_inner_error0_ != NULL)) {
								if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
									g_propagate_error (error, _inner_error0_);
									return;
								} else {
									g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
									g_clear_error (&_inner_error0_);
									return;
								}
							}
						}
					}
				}
				break;
			}
			case 21:
			{
				if (self->priv->c == ((gunichar) 'n')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_SIN;
					state = 22;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 22:
			{
				if (self->priv->c == ((gunichar) 'd')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_SIND;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 25:
			{
				if (self->priv->c == ((gunichar) 'c')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_SEC;
					state = 26;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 26:
			{
				if (self->priv->c == ((gunichar) 'd')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_SECD;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 28:
			{
				if (self->priv->c == ((gunichar) 'r')) {
					state = 29;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 29:
			{
				if (self->priv->c == ((gunichar) 't')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_SQRT;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 40:
			{
				if (self->priv->c == ((gunichar) 'o')) {
					state = 41;
				} else {
					if (self->priv->c == ((gunichar) 's')) {
						state = 45;
					} else {
						graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
								g_propagate_error (error, _inner_error0_);
								return;
							} else {
								g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
								g_clear_error (&_inner_error0_);
								return;
							}
						}
					}
				}
				break;
			}
			case 41:
			{
				if (self->priv->c == ((gunichar) 's')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_COS;
					state = 42;
				} else {
					if (self->priv->c == ((gunichar) 't')) {
						self->current_ident = GRAPHS_MATH_PARSER_IDENT_COT;
						state = 43;
					} else {
						graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
								g_propagate_error (error, _inner_error0_);
								return;
							} else {
								g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
								g_clear_error (&_inner_error0_);
								return;
							}
						}
					}
				}
				break;
			}
			case 42:
			{
				if (self->priv->c == ((gunichar) 'd')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_COSD;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 43:
			{
				if (self->priv->c == ((gunichar) 'd')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_COTD;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 45:
			{
				if (self->priv->c == ((gunichar) 'c')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_CSC;
					state = 46;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 46:
			{
				if (self->priv->c == ((gunichar) 'd')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_CSCD;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 60:
			{
				if (self->priv->c == ((gunichar) 'a')) {
					state = 61;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 61:
			{
				if (self->priv->c == ((gunichar) 'n')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_TAN;
					state = 62;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 62:
			{
				if (self->priv->c == ((gunichar) 'd')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_TAND;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 70:
			{
				if (self->priv->c == ((gunichar) 'o')) {
					state = 71;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 71:
			{
				if (self->priv->c == ((gunichar) 'g')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_LOG;
					state = 72;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 72:
			{
				if (self->priv->c == ((gunichar) '2')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_LOG2;
					state = 200;
				} else {
					if (self->priv->c == ((gunichar) '1')) {
						self->current_ident = GRAPHS_MATH_PARSER_IDENT_CUSTOM;
						state = 73;
					} else {
						graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
								g_propagate_error (error, _inner_error0_);
								return;
							} else {
								g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
								g_clear_error (&_inner_error0_);
								return;
							}
						}
					}
				}
				break;
			}
			case 73:
			{
				if (self->priv->c == ((gunichar) '0')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_LOG10;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 80:
			{
				if (self->priv->c == ((gunichar) 'b')) {
					state = 81;
				} else {
					if (self->priv->c == ((gunichar) 'r')) {
						state = 83;
					} else {
						if (self->priv->c == ((gunichar) 'c')) {
							state = 90;
						} else {
							if (self->priv->c == ((gunichar) 's')) {
								state = 96;
							} else {
								if (self->priv->c == ((gunichar) 't')) {
									state = 101;
								} else {
									graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
									if (G_UNLIKELY (_inner_error0_ != NULL)) {
										if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
											g_propagate_error (error, _inner_error0_);
											return;
										} else {
											g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
											g_clear_error (&_inner_error0_);
											return;
										}
									}
								}
							}
						}
					}
				}
				break;
			}
			case 81:
			{
				if (self->priv->c == ((gunichar) 's')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_ABS;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 83:
			{
				if (self->priv->c == ((gunichar) 'c')) {
					state = 84;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 84:
			{
				if (self->priv->c == ((gunichar) 'c')) {
					state = 90;
				} else {
					if (self->priv->c == ((gunichar) 's')) {
						state = 96;
					} else {
						if (self->priv->c == ((gunichar) 't')) {
							state = 101;
						} else {
							graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
							if (G_UNLIKELY (_inner_error0_ != NULL)) {
								if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
									g_propagate_error (error, _inner_error0_);
									return;
								} else {
									g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
									g_clear_error (&_inner_error0_);
									return;
								}
							}
						}
					}
				}
				break;
			}
			case 90:
			{
				if (self->priv->c == ((gunichar) 'o')) {
					state = 91;
				} else {
					if (self->priv->c == ((gunichar) 's')) {
						state = 94;
					} else {
						graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
								g_propagate_error (error, _inner_error0_);
								return;
							} else {
								g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
								g_clear_error (&_inner_error0_);
								return;
							}
						}
					}
				}
				break;
			}
			case 91:
			{
				if (self->priv->c == ((gunichar) 's')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_ACOS;
					state = 92;
				} else {
					if (self->priv->c == ((gunichar) 't')) {
						self->current_ident = GRAPHS_MATH_PARSER_IDENT_ACOT;
						state = 93;
					} else {
						graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
								g_propagate_error (error, _inner_error0_);
								return;
							} else {
								g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
								g_clear_error (&_inner_error0_);
								return;
							}
						}
					}
				}
				break;
			}
			case 92:
			{
				if (self->priv->c == ((gunichar) 'd')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_ACOSD;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 93:
			{
				if (self->priv->c == ((gunichar) 'd')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_ACOTD;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 94:
			{
				if (self->priv->c == ((gunichar) 'c')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_ACSC;
					state = 95;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 95:
			{
				if (self->priv->c == ((gunichar) 'd')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_ACSCD;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 96:
			{
				if (self->priv->c == ((gunichar) 'e')) {
					state = 97;
				} else {
					if (self->priv->c == ((gunichar) 'i')) {
						state = 99;
					} else {
						graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
								g_propagate_error (error, _inner_error0_);
								return;
							} else {
								g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
								g_clear_error (&_inner_error0_);
								return;
							}
						}
					}
				}
				break;
			}
			case 97:
			{
				if (self->priv->c == ((gunichar) 'c')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_ASEC;
					state = 98;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 98:
			{
				if (self->priv->c == ((gunichar) 'd')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_ASECD;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 99:
			{
				if (self->priv->c == ((gunichar) 'n')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_ASIN;
					state = 100;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 100:
			{
				if (self->priv->c == ((gunichar) 'd')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_ASIND;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 101:
			{
				if (self->priv->c == ((gunichar) 'a')) {
					state = 102;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 102:
			{
				if (self->priv->c == ((gunichar) 'n')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_ATAN;
					state = 103;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 103:
			{
				if (self->priv->c == ((gunichar) 'd')) {
					self->current_ident = GRAPHS_MATH_PARSER_IDENT_ATAND;
					state = 200;
				} else {
					graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
							g_propagate_error (error, _inner_error0_);
							return;
						} else {
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
					}
				}
				break;
			}
			case 200:
			{
				graphs_math_parser_lexer_fail_identifier (self, &state, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
						g_propagate_error (error, _inner_error0_);
						return;
					} else {
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return;
					}
				}
				break;
			}
			default:
			{
				g_assert_not_reached ();
			}
		}
		_tmp2_ = self->priv->src;
		_tmp4_ = string_get_next_char (_tmp2_, &tmp_idx, &_tmp3_);
		self->priv->c = _tmp3_;
		if (!_tmp4_) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp5_ = FALSE;
			if (g_unichar_isalnum (self->priv->c)) {
				_tmp5_ = TRUE;
			} else {
				_tmp5_ = self->priv->c == 960U;
			}
			_tmp1_ = !_tmp5_;
		}
		if (_tmp1_) {
			_tmp0_ = TRUE;
		} else {
			_tmp0_ = graphs_math_parser_is_superscript (self->priv->c);
		}
		if (_tmp0_) {
			if (state == 10) {
				self->current_ident = GRAPHS_MATH_PARSER_IDENT_E;
			} else {
				gboolean _tmp6_ = FALSE;
				if (self->current_ident == GRAPHS_MATH_PARSER_IDENT_CUSTOM) {
					_tmp6_ = !self->priv->allow_custom_ident;
				} else {
					_tmp6_ = FALSE;
				}
				if (_tmp6_) {
					GError* _tmp7_;
					_tmp7_ = g_error_new_literal (GRAPHS_MATH_ERROR, GRAPHS_MATH_ERROR_UNKNOWN_FUNCTION, "invalid identifier");
					_inner_error0_ = _tmp7_;
					if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
						g_propagate_error (error, _inner_error0_);
						return;
					} else {
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return;
					}
				}
			}
			break;
		}
		self->priv->current_end = tmp_idx;
		self->priv->c = g_unichar_tolower (self->priv->c);
	}
}

inline void
graphs_math_parser_lexer_expect_end (GraphsMathParserLexer* self,
                                     GError** error)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	if (self->current_type != GRAPHS_MATH_PARSER_TOKEN_TYPE_END) {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (GRAPHS_MATH_ERROR, GRAPHS_MATH_ERROR_SYNTAX, "trailing input");
		_inner_error0_ = _tmp0_;
		if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
}

inline void
graphs_math_parser_lexer_expect (GraphsMathParserLexer* self,
                                 GraphsMathParserTokenType t,
                                 GError** error)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	if (self->current_type != t) {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (GRAPHS_MATH_ERROR, GRAPHS_MATH_ERROR_SYNTAX, "expected token");
		_inner_error0_ = _tmp0_;
		if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	graphs_math_parser_lexer_next (self, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

gchar*
graphs_math_parser_lexer_get_current_token_as_string (GraphsMathParserLexer* self)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->src;
	_tmp1_ = string_substring (_tmp0_, (glong) self->priv->current_start, (glong) (self->priv->current_end - self->priv->current_start));
	result = _tmp1_;
	return result;
}

static void
graphs_math_parser_value_lexer_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
graphs_math_parser_value_lexer_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		graphs_math_parser_lexer_unref (value->data[0].v_pointer);
	}
}

static void
graphs_math_parser_value_lexer_copy_value (const GValue* src_value,
                                           GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = graphs_math_parser_lexer_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
graphs_math_parser_value_lexer_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
graphs_math_parser_value_lexer_collect_value (GValue* value,
                                              guint n_collect_values,
                                              GTypeCValue* collect_values,
                                              guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		GraphsMathParserLexer * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = graphs_math_parser_lexer_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
graphs_math_parser_value_lexer_lcopy_value (const GValue* value,
                                            guint n_collect_values,
                                            GTypeCValue* collect_values,
                                            guint collect_flags)
{
	GraphsMathParserLexer ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = graphs_math_parser_lexer_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
graphs_math_parser_param_spec_lexer (const gchar* name,
                                     const gchar* nick,
                                     const gchar* blurb,
                                     GType object_type,
                                     GParamFlags flags)
{
	GraphsMathParserParamSpecLexer* spec;
	g_return_val_if_fail (g_type_is_a (object_type, GRAPHS_MATH_PARSER_TYPE_LEXER), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
graphs_math_parser_value_get_lexer (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GRAPHS_MATH_PARSER_TYPE_LEXER), NULL);
	return value->data[0].v_pointer;
}

void
graphs_math_parser_value_set_lexer (GValue* value,
                                    gpointer v_object)
{
	GraphsMathParserLexer * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GRAPHS_MATH_PARSER_TYPE_LEXER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GRAPHS_MATH_PARSER_TYPE_LEXER));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		graphs_math_parser_lexer_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		graphs_math_parser_lexer_unref (old);
	}
}

void
graphs_math_parser_value_take_lexer (GValue* value,
                                     gpointer v_object)
{
	GraphsMathParserLexer * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GRAPHS_MATH_PARSER_TYPE_LEXER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GRAPHS_MATH_PARSER_TYPE_LEXER));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		graphs_math_parser_lexer_unref (old);
	}
}

static void
graphs_math_parser_lexer_class_init (GraphsMathParserLexerClass * klass,
                                     gpointer klass_data)
{
	graphs_math_parser_lexer_parent_class = g_type_class_peek_parent (klass);
	((GraphsMathParserLexerClass *) klass)->finalize = graphs_math_parser_lexer_finalize;
	g_type_class_adjust_private_offset (klass, &GraphsMathParserLexer_private_offset);
}

static void
graphs_math_parser_lexer_instance_init (GraphsMathParserLexer * self,
                                        gpointer klass)
{
	self->priv = graphs_math_parser_lexer_get_instance_private (self);
	self->ref_count = 1;
}

static void
graphs_math_parser_lexer_finalize (GraphsMathParserLexer * obj)
{
	GraphsMathParserLexer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_MATH_PARSER_TYPE_LEXER, GraphsMathParserLexer);
	g_signal_handlers_destroy (self);
}

static GType
graphs_math_parser_lexer_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { graphs_math_parser_value_lexer_init, graphs_math_parser_value_lexer_free_value, graphs_math_parser_value_lexer_copy_value, graphs_math_parser_value_lexer_peek_pointer, "p", graphs_math_parser_value_lexer_collect_value, "p", graphs_math_parser_value_lexer_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (GraphsMathParserLexerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_math_parser_lexer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsMathParserLexer), 0, (GInstanceInitFunc) graphs_math_parser_lexer_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType graphs_math_parser_lexer_type_id;
	graphs_math_parser_lexer_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GraphsMathParserLexer", &g_define_type_info, &g_define_type_fundamental_info, 0);
	GraphsMathParserLexer_private_offset = g_type_add_instance_private (graphs_math_parser_lexer_type_id, sizeof (GraphsMathParserLexerPrivate));
	return graphs_math_parser_lexer_type_id;
}

GType
graphs_math_parser_lexer_get_type (void)
{
	static volatile gsize graphs_math_parser_lexer_type_id__once = 0;
	if (g_once_init_enter (&graphs_math_parser_lexer_type_id__once)) {
		GType graphs_math_parser_lexer_type_id;
		graphs_math_parser_lexer_type_id = graphs_math_parser_lexer_get_type_once ();
		g_once_init_leave (&graphs_math_parser_lexer_type_id__once, graphs_math_parser_lexer_type_id);
	}
	return graphs_math_parser_lexer_type_id__once;
}

gpointer
graphs_math_parser_lexer_ref (gpointer instance)
{
	GraphsMathParserLexer * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
graphs_math_parser_lexer_unref (gpointer instance)
{
	GraphsMathParserLexer * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		GRAPHS_MATH_PARSER_LEXER_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

