2
0
mirror of https://github.com/sharkdp/bat synced 2024-11-18 15:26:16 +00:00

add new syntax test files

This commit is contained in:
henil 2020-11-15 00:22:08 +05:30 committed by David Peter
parent a5a9ac83e5
commit 591eba66a3
18 changed files with 646 additions and 0 deletions

View File

@ -0,0 +1,36 @@
<html>
<body>
<!-- #include file ="headers\header.inc" -->
<%
For i = 0 To 5
Response.Write("The number is " & i & "<br />")
Next
%>
<%
Response.Write("Hello World!")
%>
<%
Dim x(2,2)
x(0,0)="Volvo"
x(0,1)="BMW"
x(0,2)="Ford"
x(1,0)="Apple"
x(1,1)="Orange"
x(1,2)="Banana"
x(2,0)="Coke"
x(2,1)="Pepsi"
x(2,2)="Sprite"
for i=0 to 2
response.write("<p>")
for j=0 to 2
response.write(x(i,j) & "<br />")
next
response.write("</p>")
next
%>
</body>
</html>

View File

@ -0,0 +1,25 @@
-- This is a comment
property defaultClientName : "Mary Smith"
on greetClient(nameOfClient)
 display dialog ("Hello " & nameOfClient & "!")
end greetClient
script testGreet
 greetClient(defaultClientName)
end script
run testGreet
greetClient("Joe Jones")
set myList to {1, "what", 3}
set beginning of myList to 0
set end of myList to "four"
myList
tell application "TextEdit"
 paragraph 1 of document 1
end tell

View File

@ -0,0 +1,77 @@
set fish_greeting ""
begin
 set --local AUTOJUMP_PATH $XDG_CONFIG_HOME/fish/functions/autojump.fish
 if test -e $AUTOJUMP_PATH
 source $AUTOJUMP_PATH
 end
end
fish_vi_key_bindings
function fish_prompt
 set_color brblack
 echo -n "["(date "+%H:%M")"] "
 set_color blue
 echo -n (hostname)
 if [ $PWD != $HOME ]
 set_color brblack
 echo -n ':'
 set_color yellow
 echo -n (basename $PWD)
 end
 set_color green
 printf '%s ' (__fish_git_prompt)
 set_color red
 echo -n '| '
 set_color normal
end
function fish_greeting
 echo
 echo -e (uname -ro | awk '{print " \\\\e[1mOS: \\\\e[0;32m"$0"\\\\e[0m"}')
 echo -e (uptime -p | sed 's/^up //' | awk '{print " \\\\e[1mUptime: \\\\e[0;32m"$0"\\\\e[0m"}')
 echo -e (uname -n | awk '{print " \\\\e[1mHostname: \\\\e[0;32m"$0"\\\\e[0m"}')
 echo -e " \\e[1mDisk usage:\\e[0m"
 echo
 echo -ne (\
 df -l -h | grep -E 'dev/(xvda|sd|mapper)' | \
 awk '{printf "\\\\t%s\\\\t%4s / %4s %s\\\\n\n", $6, $3, $2, $5}' | \
 sed -e 's/^\(.*\([8][5-9]\|[9][0-9]\)%.*\)$/\\\\e[0;31m\1\\\\e[0m/' -e 's/^\(.*\([7][5-9]\|[8][0-4]\)%.*\)$/\\\\e[0;33m\1\\\\e[0m/' | \
 paste -sd ''\
 )
 echo
 echo -e " \\e[1mNetwork:\\e[0m"
 echo
 # http://tdt.rocks/linux_network_interface_naming.html
 echo -ne (\
 ip addr show up scope global | \
 grep -E ': <|inet' | \
 sed \
 -e 's/^[[:digit:]]\+: //' \
 -e 's/: <.*//' \
 -e 's/.*inet[[:digit:]]* //' \
 -e 's/\/.*//'| \
 awk 'BEGIN {i=""} /\.|:/ {print i" "$0"\\\n"; next} // {i = $0}' | \
 sort | \
 column -t -R1 | \
 # public addresses are underlined for visibility \
 sed 's/ \([^ ]\+\)$/ \\\e[4m\1/' | \
 # private addresses are not \
 sed 's/m\(\(10\.\|172\.\(1[6-9]\|2[0-9]\|3[01]\)\|192\.168\.\).*\)/m\\\e[24m\1/' | \
 # unknown interfaces are cyan \
 sed 's/^\( *[^ ]\+\)/\\\e[36m\1/' | \
 # ethernet interfaces are normal \
 sed 's/\(\(en\|em\|eth\)[^ ]* .*\)/\\\e[39m\1/' | \
 # wireless interfaces are purple \
 sed 's/\(wl[^ ]* .*\)/\\\e[35m\1/' | \
 # wwan interfaces are yellow \
 sed 's/\(ww[^ ]* .*\).*/\\\e[33m\1/' | \
 sed 's/$/\\\e[0m/' | \
 sed 's/^/\t/' \
 )
 echo
 set_color normal
end

View File

@ -0,0 +1,68 @@
#import <Foundation/Foundation.h>
class Hello {
 private:
 id greeting_text;
 public:
 Hello() {
 greeting_text = @"Hello, world!";
 }
 Hello(const char* initial_greeting_text) {
 greeting_text = [[NSString alloc] initWithUTF8String:initial_greeting_text];
 }
 void say_hello() {
 printf("%s\n", [greeting_text UTF8String]);
 }
};
@interface Greeting : NSObject {
 @private
 Hello *hello;
}
- (id)init;
- (void)dealloc;
- (void)sayGreeting;
- (void)sayGreeting:(Hello*)greeting;
@end
@implementation Greeting
- (id)init {
 self = [super init];
 if (self) {
 hello = new Hello();
 }
 return self;
}
- (void)dealloc {
 delete hello;
 [super dealloc];
}
- (void)sayGreeting {
 hello->say_hello();
}
- (void)sayGreeting:(Hello*)greeting {
 greeting->say_hello();
}
@end
int main() {
 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 Greeting *greeting = [[Greeting alloc] init];
 [greeting sayGreeting];
 Hello *hello = new Hello("Bonjour, monde!");
 [greeting sayGreeting:hello];
 delete hello;
 [greeting release];
 [pool release];
 return 0;
}

View File

@ -0,0 +1,32 @@
#import <myClass.h>
@import Foundation
// Single line comments
/*
 * Multi line comment
 */
int main (int argc, const char * argv[]) {
 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 NSLog(@"Storage size for int : %d \n", sizeof(int));
 NSLog (@"hello world");
 if (NO)
 {
 NSLog(@"I am never run");
 } else if (0)
 {
 NSLog(@"I am also never run");
 } else
 {
 NSLog(@"I print");
 }
 [pool drain];
 return 0;
}
@implementation MyClass {
 long distance;
 NSNumber height;
}

View File

@ -0,0 +1 @@
^\[START\]\d\D\h\H\s\S[a-z]\v\V\w\W.([a-z]){3,5}\[END\]$

View File

@ -0,0 +1,22 @@
class ContactsController < ApplicationController
 def new
 @contact = Contact.new
 end
 def create
 @contact = Contact.new(secure_params)
 if @contact.valid?
 UserMailer.contact_email(@contact).deliver_now
 flash[:notice] = "Message sent from #{@contact.name}."
 redirect_to root_path
 else
 render :new
 end
 end
 private
 def secure_params
 params.require(:contact).permit(:name, :email, :content)
 end
end

View File

@ -0,0 +1,22 @@
set part1 hello
set part2 how; set part3 are
set part4 you
set part2;
set greeting $part1$part2$part3$part4
set somevar {
 This is a literal $ sign, and this \} escaped
 brace remains uninterpreted
}
set name Neo
set greeting "Hello, $name"
variable name NotNeo
namespace eval people {
 set name NeoAgain
}

View File

@ -0,0 +1,40 @@
###. Single line comment
###..
Multi line comment.
This line is also part of comment.
Continues till next block element
p. This is not a comment, but I am a paragraph.
<!-- HTML comments can also be used -->
h1. This is an <h1>
h2. This is an <h2>
h3. This is an <h3>
h4. This is an <h4>
h5. This is an <h5>
h6. This is an <h6>
--
* Item
** Sub-Item
* Another item
** Another sub-item
** Yet another sub-item
*** Three levels deep
p{color:red}. This line will be red.
%span% are enclosed in percent symbols.
div. This is a new div element

View File

@ -0,0 +1,36 @@
<html>
<body>
<!-- #include file ="headers\header.inc" -->
<%
For i = 0 To 5
Response.Write("The number is " & i & "<br />")
Next
%>
<%
Response.Write("Hello World!")
%>
<%
Dim x(2,2)
x(0,0)="Volvo"
x(0,1)="BMW"
x(0,2)="Ford"
x(1,0)="Apple"
x(1,1)="Orange"
x(1,2)="Banana"
x(2,0)="Coke"
x(2,1)="Pepsi"
x(2,2)="Sprite"
for i=0 to 2
response.write("<p>")
for j=0 to 2
response.write(x(i,j) & "<br />")
next
response.write("</p>")
next
%>
</body>
</html>

View File

@ -0,0 +1,25 @@
-- This is a comment
property defaultClientName : "Mary Smith"
on greetClient(nameOfClient)
display dialog ("Hello " & nameOfClient & "!")
end greetClient
script testGreet
greetClient(defaultClientName)
end script
run testGreet
greetClient("Joe Jones")
set myList to {1, "what", 3}
set beginning of myList to 0
set end of myList to "four"
myList
tell application "TextEdit"
paragraph 1 of document 1
end tell

View File

@ -0,0 +1,77 @@
set fish_greeting ""
begin
set --local AUTOJUMP_PATH $XDG_CONFIG_HOME/fish/functions/autojump.fish
if test -e $AUTOJUMP_PATH
source $AUTOJUMP_PATH
end
end
fish_vi_key_bindings
function fish_prompt
set_color brblack
echo -n "["(date "+%H:%M")"] "
set_color blue
echo -n (hostname)
if [ $PWD != $HOME ]
set_color brblack
echo -n ':'
set_color yellow
echo -n (basename $PWD)
end
set_color green
printf '%s ' (__fish_git_prompt)
set_color red
echo -n '| '
set_color normal
end
function fish_greeting
echo
echo -e (uname -ro | awk '{print " \\\\e[1mOS: \\\\e[0;32m"$0"\\\\e[0m"}')
echo -e (uptime -p | sed 's/^up //' | awk '{print " \\\\e[1mUptime: \\\\e[0;32m"$0"\\\\e[0m"}')
echo -e (uname -n | awk '{print " \\\\e[1mHostname: \\\\e[0;32m"$0"\\\\e[0m"}')
echo -e " \\e[1mDisk usage:\\e[0m"
echo
echo -ne (\
df -l -h | grep -E 'dev/(xvda|sd|mapper)' | \
awk '{printf "\\\\t%s\\\\t%4s / %4s %s\\\\n\n", $6, $3, $2, $5}' | \
sed -e 's/^\(.*\([8][5-9]\|[9][0-9]\)%.*\)$/\\\\e[0;31m\1\\\\e[0m/' -e 's/^\(.*\([7][5-9]\|[8][0-4]\)%.*\)$/\\\\e[0;33m\1\\\\e[0m/' | \
paste -sd ''\
)
echo
echo -e " \\e[1mNetwork:\\e[0m"
echo
# http://tdt.rocks/linux_network_interface_naming.html
echo -ne (\
ip addr show up scope global | \
grep -E ': <|inet' | \
sed \
-e 's/^[[:digit:]]\+: //' \
-e 's/: <.*//' \
-e 's/.*inet[[:digit:]]* //' \
-e 's/\/.*//'| \
awk 'BEGIN {i=""} /\.|:/ {print i" "$0"\\\n"; next} // {i = $0}' | \
sort | \
column -t -R1 | \
# public addresses are underlined for visibility \
sed 's/ \([^ ]\+\)$/ \\\e[4m\1/' | \
# private addresses are not \
sed 's/m\(\(10\.\|172\.\(1[6-9]\|2[0-9]\|3[01]\)\|192\.168\.\).*\)/m\\\e[24m\1/' | \
# unknown interfaces are cyan \
sed 's/^\( *[^ ]\+\)/\\\e[36m\1/' | \
# ethernet interfaces are normal \
sed 's/\(\(en\|em\|eth\)[^ ]* .*\)/\\\e[39m\1/' | \
# wireless interfaces are purple \
sed 's/\(wl[^ ]* .*\)/\\\e[35m\1/' | \
# wwan interfaces are yellow \
sed 's/\(ww[^ ]* .*\).*/\\\e[33m\1/' | \
sed 's/$/\\\e[0m/' | \
sed 's/^/\t/' \
)
echo
set_color normal
end

View File

@ -0,0 +1,68 @@
#import <Foundation/Foundation.h>
class Hello {
private:
id greeting_text;
public:
Hello() {
greeting_text = @"Hello, world!";
}
Hello(const char* initial_greeting_text) {
greeting_text = [[NSString alloc] initWithUTF8String:initial_greeting_text];
}
void say_hello() {
printf("%s\n", [greeting_text UTF8String]);
}
};
@interface Greeting : NSObject {
@private
Hello *hello;
}
- (id)init;
- (void)dealloc;
- (void)sayGreeting;
- (void)sayGreeting:(Hello*)greeting;
@end
@implementation Greeting
- (id)init {
self = [super init];
if (self) {
hello = new Hello();
}
return self;
}
- (void)dealloc {
delete hello;
[super dealloc];
}
- (void)sayGreeting {
hello->say_hello();
}
- (void)sayGreeting:(Hello*)greeting {
greeting->say_hello();
}
@end
int main() {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Greeting *greeting = [[Greeting alloc] init];
[greeting sayGreeting];
Hello *hello = new Hello("Bonjour, monde!");
[greeting sayGreeting:hello];
delete hello;
[greeting release];
[pool release];
return 0;
}

View File

@ -0,0 +1,32 @@
#import <myClass.h>
@import Foundation
// Single line comments
/*
* Multi line comment
*/
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog(@"Storage size for int : %d \n", sizeof(int));
NSLog (@"hello world");
if (NO)
{
NSLog(@"I am never run");
} else if (0)
{
NSLog(@"I am also never run");
} else
{
NSLog(@"I print");
}
[pool drain];
return 0;
}
@implementation MyClass {
long distance;
NSNumber height;
}

View File

@ -0,0 +1 @@
^\[START\]\d\D\h\H\s\S[a-z]\v\V\w\W.([a-z]){3,5}\[END\]$

View File

@ -0,0 +1,22 @@
class ContactsController < ApplicationController
def new
@contact = Contact.new
end
def create
@contact = Contact.new(secure_params)
if @contact.valid?
UserMailer.contact_email(@contact).deliver_now
flash[:notice] = "Message sent from #{@contact.name}."
redirect_to root_path
else
render :new
end
end
private
def secure_params
params.require(:contact).permit(:name, :email, :content)
end
end

View File

@ -0,0 +1,22 @@
set part1 hello
set part2 how; set part3 are
set part4 you
set part2;
set greeting $part1$part2$part3$part4
set somevar {
This is a literal $ sign, and this \} escaped
brace remains uninterpreted
}
set name Neo
set greeting "Hello, $name"
variable name NotNeo
namespace eval people {
set name NeoAgain
}

View File

@ -0,0 +1,40 @@
###. Single line comment
###..
Multi line comment.
This line is also part of comment.
Continues till next block element
p. This is not a comment, but I am a paragraph.
<!-- HTML comments can also be used -->
h1. This is an <h1>
h2. This is an <h2>
h3. This is an <h3>
h4. This is an <h4>
h5. This is an <h5>
h6. This is an <h6>
--
* Item
** Sub-Item
* Another item
** Another sub-item
** Yet another sub-item
*** Three levels deep
p{color:red}. This line will be red.
%span% are enclosed in percent symbols.
div. This is a new div element