Skip to content

Commit

Permalink
add support for Godot Scene, Godot Resource, #566
Browse files Browse the repository at this point in the history
Bump copyright year to 2021; update Regexp::Common version
number in header comments.
  • Loading branch information
AlDanial committed Feb 17, 2021
1 parent 9eea27f commit 9b1c380
Show file tree
Hide file tree
Showing 7 changed files with 155 additions and 7 deletions.
18 changes: 14 additions & 4 deletions Unix/cloc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env perl
# cloc -- Count Lines of Code {{{1
# Copyright (C) 2006-2020 Al Danial <al.danial@gmail.com>
# Copyright (C) 2006-2021 Al Danial <al.danial@gmail.com>
# First release August 2006
#
# Includes code from:
# - SLOCCount v2.26
# http://www.dwheeler.com/sloccount/
# by David Wheeler.
# - Regexp::Common v2013031301
# http://search.cpan.org/~abigail/Regexp-Common-2013031301/lib/Regexp/Common.pm
# - Regexp::Common v2017060201
# http://search.cpan.org/~abigail/Regexp-Common-2017060201/lib/Regexp/Common.pm
# by Damian Conway and Abigail.
# - Win32::Autoglob
# http://search.cpan.org/~sburke/Win32-Autoglob-1.01/Autoglob.pm
Expand Down Expand Up @@ -7093,7 +7093,7 @@ sub really_is_bf { # {{{1
}
# if ($ind) { print "YES: $L"; } else { print "NO : $L"; }
}
my $ratio = $n_bf_indicators/scalar(@lines);
my $ratio = scalar(@lines) > 0 ? $n_bf_indicators / scalar(@lines) : 0;
my $decision = ($ratio > 0.5) || ($n_bf_indicators > 5);
printf "<- really_is_bf(Y/N=%d %s, R=%.3f, N=%d)\n",
$decision, $file, $ratio, $n_bf_indicators if $opt_v > 2;
Expand Down Expand Up @@ -8132,6 +8132,8 @@ sub set_constants { # {{{1
# 'cls' => 'TeX' ,
'dtx' => 'TeX' ,
'bst' => 'TeX' ,
'tres' => 'Godot Resource' ,
'tscn' => 'Godot Scene' ,
'thrift' => 'Thrift' ,
'tpl' => 'Smarty' ,
'trigger' => 'Apex Trigger' ,
Expand Down Expand Up @@ -8764,6 +8766,12 @@ sub set_constants { # {{{1
[ 'call_regexp_common' , 'Pascal' ],
[ 'remove_matches' , '^\s*//' ],
],
'Godot Scene' => [
[ 'remove_matches' , '^\s*;' ],
],
'Godot Resource' => [
[ 'remove_matches' , '^\s*;' ],
],
'GDScript' => [
[ 'remove_matches' , '^\s*#' ],
[ 'remove_inline' , '#.*$' ],
Expand Down Expand Up @@ -10133,6 +10141,8 @@ sub set_constants { # {{{1
'guest' => 2.86,
'guru' => 1.63,
'GDScript' => 2.50,
'Godot Scene' => 2.50,
'Godot Resource' => 2.50,
'Go' => 2.50,
'Gradle' => 4.00,
'Grails' => 1.48,
Expand Down
10 changes: 10 additions & 0 deletions Unix/t/00_C.t
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,16 @@ my @Tests = (
'ref' => '../tests/outputs/hello_app.go-2.yaml',
'args' => '--no-autogen ../tests/inputs/hello_app*.go',
},
{
'name' => 'Godot Resource',
'ref' => '../tests/outputs/door.tres.yaml',
'args' => '../tests/inputs/door.tres',
},
{
'name' => 'Godot Scene',
'ref' => '../tests/outputs/GamePanel.tscn.yaml',
'args' => '../tests/inputs/GamePanel.tscn',
},
{
'name' => 'Groovy',
# issue #139; avoid
Expand Down
16 changes: 13 additions & 3 deletions cloc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env perl
# cloc -- Count Lines of Code {{{1
# Copyright (C) 2006-2020 Al Danial <al.danial@gmail.com>
# Copyright (C) 2006-2021 Al Danial <al.danial@gmail.com>
# First release August 2006
#
# Includes code from:
# - SLOCCount v2.26
# http://www.dwheeler.com/sloccount/
# by David Wheeler.
# - Regexp::Common v2013031301
# http://search.cpan.org/~abigail/Regexp-Common-2013031301/lib/Regexp/Common.pm
# - Regexp::Common v2017060201
# http://search.cpan.org/~abigail/Regexp-Common-2017060201/lib/Regexp/Common.pm
# by Damian Conway and Abigail.
# - Win32::Autoglob
# http://search.cpan.org/~sburke/Win32-Autoglob-1.01/Autoglob.pm
Expand Down Expand Up @@ -8122,6 +8122,8 @@ sub set_constants { # {{{1
# 'cls' => 'TeX' ,
'dtx' => 'TeX' ,
'bst' => 'TeX' ,
'tres' => 'Godot Resource' ,
'tscn' => 'Godot Scene' ,
'thrift' => 'Thrift' ,
'tpl' => 'Smarty' ,
'trigger' => 'Apex Trigger' ,
Expand Down Expand Up @@ -8754,6 +8756,12 @@ sub set_constants { # {{{1
[ 'call_regexp_common' , 'Pascal' ],
[ 'remove_matches' , '^\s*//' ],
],
'Godot Scene' => [
[ 'remove_matches' , '^\s*;' ],
],
'Godot Resource' => [
[ 'remove_matches' , '^\s*;' ],
],
'GDScript' => [
[ 'remove_matches' , '^\s*#' ],
[ 'remove_inline' , '#.*$' ],
Expand Down Expand Up @@ -10123,6 +10131,8 @@ sub set_constants { # {{{1
'guest' => 2.86,
'guru' => 1.63,
'GDScript' => 2.50,
'Godot Scene' => 2.50,
'Godot Resource' => 2.50,
'Go' => 2.50,
'Gradle' => 4.00,
'Grails' => 1.48,
Expand Down
46 changes: 46 additions & 0 deletions tests/inputs/GamePanel.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
; https://github.com/zacryol/spindle-of-serendipity/raw/develop/godot/game/GamePanel.tscn
[gd_scene load_steps=19 format=2]

[ext_resource path="res://game/components/PlayersPanel.tscn" type="PackedScene" id=1]
[ext_resource path="res://game/components/Keyboard.tscn" type="PackedScene" id=2]
[ext_resource path="res://game/components/EntryDisplay.tscn" type="PackedScene" id=3]
[ext_resource path="res://game/components/Spindle.tscn" type="PackedScene" id=4]
[ext_resource path="res://game/GamePanel.gd" type="Script" id=5]
[ext_resource path="res://GameTheme.theme" type="Theme" id=6]
[ext_resource path="res://game/VScreen.tscn" type="PackedScene" id=7]
[ext_resource path="res://Xolonium-Bold.otf" type="DynamicFontData" id=8]
[ext_resource path="res://game/RoundSign.gd" type="Script" id=9]
[ext_resource path="res://tex/star_04.png" type="Texture" id=10]

[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.0862745, 0.0862745, 0.101961, 0.631373 )
corner_radius_top_left = 25
corner_radius_top_right = 25
corner_radius_bottom_right = 25
corner_radius_bottom_left = 25
shadow_color = Color( 0.0862745, 0.0862745, 0.101961, 0.74902 )
shadow_size = 50

; [sub_resource type="DynamicFont" id=2]
; size = 100
; outline_size = 5
; outline_color = Color( 0, 0, 0, 1 )
; use_mipmaps = true
; use_filter = true
; font_data = ExtResource( 8 )

[sub_resource type="Animation" id=3]
resource_name = "In"
length = 0.2
tracks/0/type = "value"
tracks/0/path = NodePath("Main:rect_position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.2 ),
"transitions": PoolRealArray( 1, 0.329877 ),
"update": 0,
"values": [ Vector2( 1280, 0 ), Vector2( 0, 0 ) ]
}
30 changes: 30 additions & 0 deletions tests/inputs/door.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
; https://github.com/godotengine/tps-demo/raw/master/door/model/door.tres
[gd_resource type="SpatialMaterial" load_steps=5 format=2]

[ext_resource path="res://door/textures/door_orm.png" type="Texture" id=1]
[ext_resource path="res://door/textures/door_emission.png" type="Texture" id=2]
[ext_resource path="res://door/textures/door_normal.png" type="Texture" id=3]
[ext_resource path="res://door/textures/door_albedo.png" type="Texture" id=4]

[resource]
resource_name = "door"
albedo_texture = ExtResource( 4 )
; metallic = 1.0
; metallic_texture = ExtResource( 1 )
; metallic_texture_channel = 2
; roughness_texture = ExtResource( 1 )
; roughness_texture_channel = 1
; emission_enabled = true
; emission = Color( 0, 0, 0, 1 )
emission_energy = 3.0
emission_operator = 0
emission_on_uv2 = false
emission_texture = ExtResource( 2 )
normal_enabled = true
normal_scale = 1.0
normal_texture = ExtResource( 3 )
ao_enabled = true
ao_light_affect = 0.0
ao_texture = ExtResource( 1 )
ao_on_uv2 = false
ao_texture_channel = 0
21 changes: 21 additions & 0 deletions tests/outputs/GamePanel.tscn.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# github.com/AlDanial/cloc
header :
cloc_url : github.com/AlDanial/cloc
cloc_version : 1.89
elapsed_seconds : 0.00651192665100098
n_files : 1
n_lines : 46
files_per_second : 153.564383260718
lines_per_second : 7063.96162999304
report_file : ../outputs/GamePanel.tscn
'Godot Scene' :
nFiles: 1
blank: 4
comment: 8
code: 34
SUM:
blank: 4
comment: 8
code: 34
nFiles: 1
21 changes: 21 additions & 0 deletions tests/outputs/door.tres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# github.com/AlDanial/cloc
header :
cloc_url : github.com/AlDanial/cloc
cloc_version : 1.89
elapsed_seconds : 0.00702595710754395
n_files : 1
n_lines : 30
files_per_second : 142.329363059486
lines_per_second : 4269.88089178459
report_file : ../outputs/door.tres.yaml
'Godot Resource' :
nFiles: 1
blank: 2
comment: 8
code: 20
SUM:
blank: 2
comment: 8
code: 20
nFiles: 1

0 comments on commit 9b1c380

Please sign in to comment.