Skip to content

Instantly share code, notes, and snippets.

@andrew-wilkes
Created February 27, 2019 10:01
Show Gist options
  • Save andrew-wilkes/f93eca84d153ea4966555cd658583409 to your computer and use it in GitHub Desktop.
Save andrew-wilkes/f93eca84d153ea4966555cd658583409 to your computer and use it in GitHub Desktop.
GDScript Keywords Extractor Script
<?php
$txt = "if See if/else/elif.
elif See if/else/elif.
else See if/else/elif.
for See for.
while See while.
match See match.
break Exits the execution of the current for or while loop.
continue Immediately skips to the next iteration of the for or while loop.
pass Used where a statement is required syntactically but execution of code is undesired, e.g. in empty functions.
return Returns a value from a function.
class Defines a class.
extends Defines what class to extend with the current class.
is Tests whether a variable extends a given class, or is of a given built-in type.
as Cast the value to a given type if possible.
self Refers to current class instance.
tool Executes the script in the editor.
signal Defines a signal.
func Defines a function.
static Defines a static function. Static member variables are not allowed.
const Defines a constant.
enum Defines an enum.
var Defines a variable.
onready Initializes a variable once the Node the script is attached to and its children are part of the scene tree.
export Saves a variable along with the resource it’s attached to and makes it visible and modifiable in the editor.
setget Defines setter and getter functions for a variable.
breakpoint Editor helper for debugger breakpoints.
preload Preloads a class or variable. See Classes as resources.
yield Coroutine support. See Coroutines with yield.
assert Asserts a condition, logs error on failure. Ignored in non-debug builds. See Assert keyword.
remote Networking RPC annotation. See high-level multiplayer docs.
master Networking RPC annotation. See high-level multiplayer docs.
puppet Networking RPC annotation. See high-level multiplayer docs.
remotesync Networking RPC annotation. See high-level multiplayer docs.
mastersync Networking RPC annotation. See high-level multiplayer docs.
puppetsync Networking RPC annotation. See high-level multiplayer docs.
PI PI constant.
TAU TAU constant.
INF Infinity constant. Used for comparisons.
NAN";
$lines = explode(PHP_EOL, $txt);
$code = [];
foreach($lines as $line)
{
$code[] = explode(" ", $line)[0];
}
echo implode('|', $code);
@andrew-wilkes
Copy link
Author

Run from the command line to capture to a file as follows: php gdscript-keywords-stripper.php > keywords.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment