mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-08-04 07:52:24 +00:00
Fixed M lexer name. Merged with upstream's latest changes.
This commit is contained in:
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
package addressbook
|
||||
|
||||
class Contact(
|
||||
val name : String,
|
||||
val emails : List<EmailAddress>,
|
||||
val addresses : List<PostalAddress>,
|
||||
val phonenums : List<PhoneNumber>
|
||||
)
|
||||
|
||||
class EmailAddress(
|
||||
val user : String,
|
||||
val host : String
|
||||
)
|
||||
|
||||
class PostalAddress(
|
||||
val streetAddress : String,
|
||||
val city : String,
|
||||
val zip : String,
|
||||
val state : USState?,
|
||||
val country : Country
|
||||
) {
|
||||
assert {(state == null) xor (country == Countries["US"]) }
|
||||
}
|
||||
|
||||
class PhoneNumber(
|
||||
val country : Country,
|
||||
val areaCode : Int,
|
||||
val number : Long
|
||||
)
|
||||
|
||||
object Countries {
|
||||
fun get(id : CountryID) : Country = countryTable[id]
|
||||
|
||||
private var table : Map<String, Country>? = null
|
||||
private val countryTable : Map<String, Country>
|
||||
get() {
|
||||
if (table == null) {
|
||||
table = HashMap()
|
||||
for (line in TextFile("countries.txt").lines(stripWhiteSpace = true)) {
|
||||
table[line] = Country(line)
|
||||
}
|
||||
}
|
||||
return table
|
||||
}
|
||||
}
|
||||
|
||||
class Country(val name : String)
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
# Maintainer: Daniel Micay <danielmicay@gmail.com>
|
||||
pkgname=stud-git
|
||||
pkgver=20120316
|
||||
pkgrel=1
|
||||
pkgdesc="The Scalable TLS Unwrapping Daemon"
|
||||
arch=(i686 x86_64)
|
||||
url="https://github.com/bumptech/stud"
|
||||
license=('BSD')
|
||||
depends=(libev openssl)
|
||||
makedepends=(git)
|
||||
provides=(stud)
|
||||
conflicts=(stud)
|
||||
|
||||
_gitroot=https://github.com/bumptech/stud.git
|
||||
_gitname=stud
|
||||
|
||||
build() {
|
||||
cd "$srcdir"
|
||||
msg "Connecting to GIT server...."
|
||||
|
||||
if [[ -d "$_gitname" ]]; then
|
||||
cd "$_gitname" && git pull origin
|
||||
msg "The local files are updated."
|
||||
else
|
||||
git clone "$_gitroot" "$_gitname"
|
||||
fi
|
||||
|
||||
msg "GIT checkout done or server timeout"
|
||||
msg "Starting build..."
|
||||
|
||||
rm -rf "$srcdir/$_gitname-build"
|
||||
git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
|
||||
cd "$srcdir/$_gitname-build"
|
||||
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$srcdir/$_gitname-build"
|
||||
make PREFIX=/usr DESTDIR="$pkgdir/" install
|
||||
install -Dm755 init.stud "$pkgdir/etc/rc.d/stud"
|
||||
mkdir -p "$pkgdir/etc/stud"
|
||||
}
|
||||
Vendored
Vendored
+1
@@ -0,0 +1 @@
|
||||
<% template foo() %>
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
-- VHDL example file
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
|
||||
entity inverter is
|
||||
port(a : in std_logic;
|
||||
b : out std_logic);
|
||||
end entity;
|
||||
|
||||
architecture rtl of inverter is
|
||||
begin
|
||||
b <= not a;
|
||||
end architecture;
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
classdef matlab_class
|
||||
properties
|
||||
R;
|
||||
G;
|
||||
B;
|
||||
end
|
||||
methods
|
||||
function obj = matlab_class(r,g,b)
|
||||
obj.R = r;
|
||||
obj.G = g;
|
||||
obj.B = b;
|
||||
end
|
||||
function disp(obj)
|
||||
disp(['Red: ' num2str(obj.R) ...
|
||||
', Green: ' num2str(obj.G) ...
|
||||
', Blue: ' num2str(obj.B)]);
|
||||
end
|
||||
end
|
||||
enumeration
|
||||
red (1,0,0)
|
||||
green (0,1,0)
|
||||
blue (0,0,1)
|
||||
cyan (0,1,1)
|
||||
magenta (1,0,1)
|
||||
yellow (1,1,0)
|
||||
black (0,0,0)
|
||||
white (1,1,1)
|
||||
end
|
||||
end
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
function ret = matlab_function2(A,B)
|
||||
% Simple function that combines two values using function handles and displays
|
||||
% the return value
|
||||
|
||||
% create function handles
|
||||
fun1=@interface;
|
||||
fun2=@implementation;
|
||||
fun3=@property;
|
||||
fun4=@synthesize;
|
||||
|
||||
% use function handles
|
||||
ret = fun1(A)+fun2(A)+fun3(B)+fun4(B);
|
||||
|
||||
% Display the return value
|
||||
disp('Return value in function');
|
||||
disp(ret);
|
||||
|
||||
|
||||
function A=interface(A)
|
||||
% simple sub-function with same name Objective-C @keyword
|
||||
A=2*A;
|
||||
|
||||
function A=implementation(A)
|
||||
% simple sub-function with same name Objective-C @keyword
|
||||
A=A^2;
|
||||
|
||||
function B=property(B)
|
||||
% simple sub-function with same name Objective-C @keyword
|
||||
B=2*B;
|
||||
|
||||
function B=synthesize(B)
|
||||
% simple sub-function with same name Objective-C @keyword
|
||||
B=B^2;
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
% Matlab example script 2
|
||||
% Comments precended with arbitrary whitespace (spaces or tabs)
|
||||
|
||||
%Call matlab_function function which resides in the same directory
|
||||
|
||||
value1 = 5 % semicolon at end of line is not mandatory, only suppresses output to command line.
|
||||
value2 = 3
|
||||
|
||||
% Calculate sum of value1 and value2
|
||||
result = matlab_function(value1,value2);
|
||||
|
||||
disp('called from script')
|
||||
disp(result);
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
class Point {
|
||||
Point(this.x, this.y);
|
||||
distanceTo(Point other) {
|
||||
var dx = x - other.x;
|
||||
var dy = y - other.y;
|
||||
return Math.sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
var x, y;
|
||||
}
|
||||
|
||||
main() {
|
||||
Point p = new Point(2, 3);
|
||||
Point q = new Point(3, 4);
|
||||
print('distance from p to q = ${p.distanceTo(q)}');
|
||||
}
|
||||
Vendored
+24
File diff suppressed because one or more lines are too long
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
## Test case from Issue #445
|
||||
|
||||
#STOCKCORR - The original, unoptimised code that simulates two correlated assets
|
||||
function stockcorr()
|
||||
|
||||
## Correlated asset information
|
||||
CurrentPrice = [78. 102.] # Initial Prices of the two stocks
|
||||
Corr = [1. 0.4; 0.4 1.] # Correlation Matrix
|
||||
T = 500 # Number of days to simulate = 2years = 500days
|
||||
n = 100000 # Number of simulations
|
||||
dt = 1/250 # Time step (1year = 250days)
|
||||
Div=[0.01 0.01] # Dividend
|
||||
Vol=[0.2 0.3] # Volatility
|
||||
|
||||
## Market Information
|
||||
r = 0.03 # Risk-free rate
|
||||
|
||||
## Define storages
|
||||
SimulPriceA = zeros(T,n) # Simulated Price of Asset A
|
||||
SimulPriceA[1,:] = CurrentPrice[1]
|
||||
SimulPriceB = zeros(T,n) # Simulated Price of Asset B
|
||||
SimulPriceB[1,:] = CurrentPrice[2]
|
||||
|
||||
## Generating the paths of stock prices by Geometric Brownian Motion
|
||||
UpperTriangle=chol(Corr) # UpperTriangle Matrix by Cholesky decomposition
|
||||
|
||||
for i = 1:n
|
||||
Wiener = randn(T-1,2)
|
||||
CorrWiener = Wiener*UpperTriangle
|
||||
for j = 2:T
|
||||
SimulPriceA[j,i] = SimulPriceA[j-1,i]*exp((r-Div[1]-Vol[1]^2/2)*dt+Vol[1]*sqrt(dt)*CorrWiener[j-1,1])
|
||||
SimulPriceB[j,i] = SimulPriceB[j-1,i]*exp((r-Div[2]-Vol[2]^2/2)*dt+Vol[2]*sqrt(dt)*CorrWiener[j-1,2])
|
||||
end
|
||||
end
|
||||
|
||||
return (SimulPriceA, SimulPriceB)
|
||||
end
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<body>
|
||||
<h2>My CD Collection</h2>
|
||||
<table border="1">
|
||||
<tr bgcolor="#9acd32">
|
||||
<th>Title</th>
|
||||
<th>Artist</th>
|
||||
</tr>
|
||||
<xsl:for-each select="catalog/cd">
|
||||
<tr>
|
||||
<td><xsl:value-of select="title"/></td>
|
||||
<td><xsl:value-of select="artist"/></td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
Reference in New Issue
Block a user