mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 20:38:47 +00:00
Added Zephir language
This commit is contained in:
53
samples/Zephir/Cblock.zep
Normal file
53
samples/Zephir/Cblock.zep
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* CBLOCK tests
|
||||
* asfas
|
||||
*/
|
||||
|
||||
%{
|
||||
// top statement before namespace, add to after headers
|
||||
#define MAX_FACTOR 40
|
||||
}%
|
||||
|
||||
namespace Test;
|
||||
|
||||
%{
|
||||
// top statement before class, add to after headers
|
||||
// test include .h
|
||||
#include "kernel/require.h"
|
||||
}%
|
||||
|
||||
%{
|
||||
|
||||
// c implement fibonacci
|
||||
static long fibonacci(long n) {
|
||||
if (n < 2) return n;
|
||||
else return fibonacci(n - 2) + fibonacci(n - 1);
|
||||
}
|
||||
|
||||
}%
|
||||
|
||||
class Cblock
|
||||
{
|
||||
public function testCblock1()
|
||||
{
|
||||
int a = 0;
|
||||
|
||||
%{
|
||||
a = MAX_FACTOR;
|
||||
}%
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
public function testCblock2()
|
||||
{
|
||||
long a = 0;
|
||||
|
||||
%{
|
||||
a = fibonacci(MAX_FACTOR);
|
||||
}%
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user