Added generated rule for Zephir language

This commit is contained in:
Gusakov Nikita
2014-04-26 16:00:14 +04:00
parent 31921838cd
commit 1b7f26091c
6 changed files with 100 additions and 19 deletions

View File

@@ -63,7 +63,8 @@ module Linguist
generated_jni_header? ||
composer_lock? ||
node_modules? ||
vcr_cassette?
vcr_cassette? ||
generated_by_zephir?
end
# Internal: Is the blob an XCode project file?
@@ -237,6 +238,13 @@ module Linguist
!!name.match(/composer.lock/)
end
# Internal: Is the blob a generated by Zephir
#
# Returns true or false.
def generated_by_zephir?
!!name.match(/.\.zep\.(?:c|h|php)$/)
end
# Is the blob a VCR Cassette file?
#
# Returns true or false

View File

@@ -741,10 +741,15 @@
],
"YAML": [
".gemrc"
],
"Zephir": [
"exception.zep.c",
"exception.zep.h",
"exception.zep.php"
]
},
"tokens_total": 614434,
"languages_total": 812,
"tokens_total": 614493,
"languages_total": 815,
"tokens": {
"ABAP": {
"*/**": 1,
@@ -66810,27 +66815,27 @@
},
"Zephir": {
"%": 10,
"{": 56,
"{": 58,
"#define": 1,
"MAX_FACTOR": 3,
"}": 50,
"namespace": 3,
"Test": 2,
";": 86,
"#include": 1,
"}": 52,
"namespace": 4,
"Test": 4,
";": 91,
"#include": 9,
"static": 1,
"long": 3,
"fibonacci": 4,
"(": 55,
"(": 59,
"n": 5,
")": 53,
")": 57,
"if": 39,
"<": 1,
"return": 25,
"<": 2,
"return": 26,
"else": 11,
"-": 25,
"+": 5,
"class": 2,
"class": 3,
"Cblock": 1,
"public": 22,
"function": 22,
@@ -66838,7 +66843,29 @@
"int": 3,
"a": 6,
"testCblock2": 1,
"Router": 1,
"#ifdef": 1,
"HAVE_CONFIG_H": 1,
"#endif": 1,
"<php.h>": 1,
"<Zend/zend_operators.h>": 1,
"<Zend/zend_exceptions.h>": 1,
"<Zend/zend_interfaces.h>": 1,
"ZEPHIR_INIT_CLASS": 2,
"Test_Router_Exception": 2,
"ZEPHIR_REGISTER_CLASS_EX": 1,
"Router": 3,
"Exception": 4,
"test": 1,
"router_exception": 1,
"zend_exception_get_default": 1,
"TSRMLS_C": 1,
"NULL": 1,
"SUCCESS": 1,
"extern": 1,
"zend_class_entry": 1,
"*test_router_exception_ce": 1,
"php": 1,
"extends": 1,
"Route": 1,
"protected": 9,
"_pattern": 3,
@@ -66917,7 +66944,6 @@
"typeof": 2,
"throw": 1,
"new": 1,
"Exception": 1,
"explode": 1,
"switch": 1,
"count": 1,
@@ -67189,7 +67215,7 @@
"XSLT": 44,
"Xtend": 399,
"YAML": 77,
"Zephir": 1026,
"Zephir": 1085,
"Zimpl": 123
},
"languages": {
@@ -67380,8 +67406,8 @@
"XSLT": 1,
"Xtend": 2,
"YAML": 2,
"Zephir": 2,
"Zephir": 5,
"Zimpl": 1
},
"md5": "3e0901633ee5729c6dac371442522f33"
"md5": "c05a50dcc060bd36069504536d354c35"
}

28
samples/Zephir/filenames/exception.zep.c generated Normal file
View File

@@ -0,0 +1,28 @@
#ifdef HAVE_CONFIG_H
#include "../../ext_config.h"
#endif
#include <php.h>
#include "../../php_ext.h"
#include "../../ext.h"
#include <Zend/zend_operators.h>
#include <Zend/zend_exceptions.h>
#include <Zend/zend_interfaces.h>
#include "kernel/main.h"
/**
* Test\Router\Exception
*
* Exceptions generated by the router
*/
ZEPHIR_INIT_CLASS(Test_Router_Exception) {
ZEPHIR_REGISTER_CLASS_EX(Test\\Router, Exception, test, router_exception, zend_exception_get_default(TSRMLS_C), NULL, 0);
return SUCCESS;
}

View File

@@ -0,0 +1,4 @@
extern zend_class_entry *test_router_exception_ce;
ZEPHIR_INIT_CLASS(Test_Router_Exception);

View File

@@ -0,0 +1,8 @@
<?php
namespace Test\Router;
class Exception extends \Exception
{
}

View File

@@ -247,6 +247,13 @@ class TestBlob < Test::Unit::TestCase
# Generated VCR
assert blob("YAML/vcr_cassette.yml").generated?
# Generated by Zephir
assert blob("Zephir/filenames/exception.zep.c").generated?
assert blob("Zephir/filenames/exception.zep.h").generated?
assert blob("Zephir/filenames/exception.zep.php").generated?
assert !blob("Zephir/Router.zep").generated?
assert Linguist::Generated.generated?("node_modules/grunt/lib/grunt.js", nil)
end