Sha256: c69014a3a91283cb64ae7845915be57596b38980de9f67cf18f06024781ea4f3

Contents?: true

Size: 1.46 KB

Versions: 92

Compression:

Stored size: 1.46 KB

Contents

/*
Shiltiumcomp -- the first Shiltolang compiler

Copyright (C) 2010 Gregory Cohen <gregorycohenvideos@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "../global_headers/headers.h"

attr_nonnull
void insert_variable_into_scope(
	ParserState* cr state,
	char* const name,
	const u length,
	Variable* cr variable
) {
	void** new_value;
	
	assert_comparison(state, !=, NULL, ParserState* cr, void*);
	assert_comparison(name, !=, NULL, const String* cr, void*);
	assert_comparison(variable, !=, NULL, Variable* cr, void*);
	
	if (!hash_table_insert_with_string_key(
		&state->scope.variables_in_scope,
		name,
		length,
		variable,
		false,
		&new_value
	)) {
		output_nullt_string("Identifier error: variable " OPENING_QUOTE);
		output_string(name, length);
		output_nullt_string(CLOSING_QUOTE " already declared on line ");
		putu(ARROW((Variable*)DEREF(new_value), line_declared_on));
		output_newline();
	}
}

Version data entries

92 entries across 46 versions & 6 rubygems

Version Path
elonmusk-1.0.91 ./other/old_compiler/shiltiumcomp58/portable/insert_variable_into_scope.c
elonmusk-1.0.91 ./other/old_compiler/shiltiumcomp59/portable/insert_variable_into_scope.c
politics-1.0.91 ./other/old_compiler/shiltiumcomp59/portable/insert_variable_into_scope.c
politics-1.0.91 ./other/old_compiler/shiltiumcomp58/portable/insert_variable_into_scope.c
politics-1.0.89 ./other/old_compiler/shiltiumcomp58/portable/insert_variable_into_scope.c
politics-1.0.89 ./other/old_compiler/shiltiumcomp59/portable/insert_variable_into_scope.c
ufos-1.0.87 ./other/old_compiler/shiltiumcomp58/portable/insert_variable_into_scope.c
ufos-1.0.87 ./other/old_compiler/shiltiumcomp59/portable/insert_variable_into_scope.c
aliens-1.0.87 ./other/old_compiler/shiltiumcomp58/portable/insert_variable_into_scope.c
aliens-1.0.87 ./other/old_compiler/shiltiumcomp59/portable/insert_variable_into_scope.c
freespeech-1.0.87 ./other/old_compiler/shiltiumcomp59/portable/insert_variable_into_scope.c
freespeech-1.0.87 ./other/old_compiler/shiltiumcomp58/portable/insert_variable_into_scope.c
elonmusk-1.0.87 ./other/old_compiler/shiltiumcomp59/portable/insert_variable_into_scope.c
elonmusk-1.0.87 ./other/old_compiler/shiltiumcomp58/portable/insert_variable_into_scope.c
politics-1.0.87 ./other/old_compiler/shiltiumcomp58/portable/insert_variable_into_scope.c
politics-1.0.87 ./other/old_compiler/shiltiumcomp59/portable/insert_variable_into_scope.c
ufos-1.0.88 ./other/old_compiler/shiltiumcomp59/portable/insert_variable_into_scope.c
ufos-1.0.88 ./other/old_compiler/shiltiumcomp58/portable/insert_variable_into_scope.c
aliens-1.0.88 ./other/old_compiler/shiltiumcomp59/portable/insert_variable_into_scope.c
aliens-1.0.88 ./other/old_compiler/shiltiumcomp58/portable/insert_variable_into_scope.c