新增代码文件支持行号显示
@ -6,3 +6,4 @@ String spTheme = "dart_mode";
|
||||
String spSecretLogined = "secret_logined";
|
||||
String spCustomColor = "customColor";
|
||||
String spLoginHistory = "loginHistory";
|
||||
String spShowLine = "spShowLine";
|
||||
|
||||
@ -1,12 +1,16 @@
|
||||
import 'package:code_text_field/code_text_field.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:highlight/languages/powershell.dart';
|
||||
import 'package:qinglong_app/base/http/api.dart';
|
||||
import 'package:qinglong_app/base/http/http.dart';
|
||||
import 'package:qinglong_app/base/ql_app_bar.dart';
|
||||
import 'package:qinglong_app/base/sp_const.dart';
|
||||
import 'package:qinglong_app/base/theme.dart';
|
||||
import 'package:qinglong_app/utils/extension.dart';
|
||||
import 'package:qinglong_app/utils/sp_utils.dart';
|
||||
|
||||
class ConfigEditPage extends ConsumerStatefulWidget {
|
||||
final String content;
|
||||
@ -21,6 +25,8 @@ class ConfigEditPage extends ConsumerStatefulWidget {
|
||||
class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
|
||||
CodeController? _codeController;
|
||||
late String result;
|
||||
late String preResult;
|
||||
List<String> operateList = [];
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
@ -31,18 +37,23 @@ class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
|
||||
@override
|
||||
void initState() {
|
||||
result = widget.content;
|
||||
|
||||
preResult = widget.content;
|
||||
super.initState();
|
||||
generateOperateList();
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
focusNode.requestFocus();
|
||||
checkClipBoard();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> notifyICloud(BuildContext context, String? title, String? content) async {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_codeController ??= CodeController(
|
||||
text: widget.content,
|
||||
text: result,
|
||||
language: powershell,
|
||||
onChange: (value) {
|
||||
result = value;
|
||||
@ -56,13 +67,78 @@ class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
|
||||
appBar: QlAppBar(
|
||||
canBack: true,
|
||||
backCall: () {
|
||||
Navigator.of(context).pop();
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
|
||||
if (preResult == result) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
useRootNavigator: false,
|
||||
builder: (childContext) => CupertinoAlertDialog(
|
||||
title: const Text("温馨提示"),
|
||||
content: const Text("你编辑的内容还没用提交,确定退出吗?"),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: const Text(
|
||||
"取消",
|
||||
style: TextStyle(
|
||||
color: Color(0xff999999),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(childContext).pop();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
"确定",
|
||||
style: TextStyle(
|
||||
color: ref.watch(themeProvider).primaryColor,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(childContext).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
title: '编辑${widget.title}',
|
||||
actions: [
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
child: PopupMenuButton<String>(
|
||||
onSelected: (String result) {
|
||||
updateValueBykey(result);
|
||||
},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
||||
...operateList
|
||||
.map(
|
||||
(e) => PopupMenuItem<String>(
|
||||
child: Text(e),
|
||||
value: e,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
],
|
||||
child: const Center(
|
||||
child: Icon(
|
||||
CupertinoIcons.arrow_up_right_diamond,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
HttpResponse<NullResponse> response = await Api.saveFile(widget.title, result);
|
||||
await notifyICloud(context, widget.title, result);
|
||||
if (response.success) {
|
||||
"提交成功".toast();
|
||||
Navigator.of(context).pop(widget.title);
|
||||
@ -89,23 +165,176 @@ class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
|
||||
),
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
child: CodeField(
|
||||
controller: _codeController!,
|
||||
expands: true,
|
||||
wrap: true,
|
||||
lineNumberStyle: const LineNumberStyle(
|
||||
width: 0,
|
||||
margin: 0,
|
||||
textStyle: TextStyle(
|
||||
color: Colors.transparent,
|
||||
fontSize: 0,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: SpUtil.getBool(spShowLine, defValue: false) ? 0 : 10,
|
||||
),
|
||||
child: CodeField(
|
||||
controller: _codeController!,
|
||||
expands: true,
|
||||
background: Colors.white,
|
||||
wrap: SpUtil.getBool(spShowLine, defValue: false) ? false : true,
|
||||
hideColumn: !SpUtil.getBool(spShowLine, defValue: false),
|
||||
lineNumberStyle: LineNumberStyle(
|
||||
textStyle: TextStyle(
|
||||
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
background: ref.watch(themeProvider).themeColor.settingBgColor(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
FocusNode focusNode = FocusNode();
|
||||
|
||||
void generateOperateList() {
|
||||
operateList.clear();
|
||||
List<String> array = result.split("\n");
|
||||
for (String a in array) {
|
||||
String t = a.replaceAll(" ", "");
|
||||
if (t.trim().startsWith("export")) {
|
||||
int i = t.indexOf("export") + 6;
|
||||
int j = t.indexOf("=");
|
||||
operateList.add(t.substring(i, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void updateValueBykey(String key) async {
|
||||
String defaultValue = "";
|
||||
try {
|
||||
var clipBoard = await Clipboard.getData(Clipboard.kTextPlain);
|
||||
|
||||
if (clipBoard != null && clipBoard.text != null) {
|
||||
String tempText = clipBoard.text!;
|
||||
|
||||
if (tempText.trim().contains("export")) {
|
||||
int i = tempText.trim().indexOf("\"");
|
||||
int j = tempText.trim().lastIndexOf("\"");
|
||||
|
||||
if (i == -1 || j == -1) {
|
||||
i = tempText.trim().indexOf("'");
|
||||
j = tempText.trim().lastIndexOf("'");
|
||||
}
|
||||
|
||||
defaultValue = tempText.trim().substring(i, j);
|
||||
} else {
|
||||
defaultValue = tempText;
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
TextEditingController controller = TextEditingController(text: defaultValue.replaceAll("\"", "").replaceAll("'", ""));
|
||||
showCupertinoDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: Text("编辑$key:"),
|
||||
content: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 10,
|
||||
),
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
decoration: const InputDecoration(
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.all(4),
|
||||
hintText: "请输入值",
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
autofocus: false,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: const Text(
|
||||
"取消",
|
||||
style: TextStyle(
|
||||
color: Color(0xff999999),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
"确定",
|
||||
style: TextStyle(
|
||||
color: ref.watch(themeProvider).primaryColor,
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
updateValueByKey(key, controller.text);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void updateValueByKey(String key, String text) {
|
||||
List<String> array = result.split("\n");
|
||||
for (String a in array) {
|
||||
String t = a.replaceAll(" ", "");
|
||||
if (t.trim().startsWith("export")) {
|
||||
int i = t.indexOf("export") + 6;
|
||||
int j = t.indexOf("=");
|
||||
|
||||
String tempResult = t.substring(i, j);
|
||||
if (tempResult == key) {
|
||||
result = result.replaceAll(a, "\nexport $key = \"$text\" \n\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_codeController = null;
|
||||
setState(() {});
|
||||
"已修改".toast();
|
||||
}
|
||||
|
||||
void checkClipBoard() async {
|
||||
try {
|
||||
String key = "";
|
||||
String value = "";
|
||||
var clipBoard = await Clipboard.getData(Clipboard.kTextPlain);
|
||||
|
||||
if (clipBoard != null && clipBoard.text != null) {
|
||||
String tempText = clipBoard.text!;
|
||||
|
||||
if (tempText.trim().contains("export")) {
|
||||
int kI = tempText.trim().indexOf("export");
|
||||
int kJ = tempText.trim().indexOf("=");
|
||||
|
||||
key = tempText.trim().substring(kI + 6, kJ);
|
||||
|
||||
int i = tempText.trim().indexOf("\"");
|
||||
int j = tempText.trim().lastIndexOf("\"");
|
||||
|
||||
if (i == -1 || j == -1) {
|
||||
i = tempText.trim().indexOf("'");
|
||||
j = tempText.trim().lastIndexOf("'");
|
||||
}
|
||||
value = tempText.trim().substring(i, j);
|
||||
|
||||
if (key.isNotEmpty && result.contains(key) && value.isNotEmpty) {
|
||||
WidgetsBinding.instance.endOfFrame.then((value) {
|
||||
updateValueBykey(key);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,18 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:code_text_field/code_text_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:highlight/languages/powershell.dart';
|
||||
import 'package:qinglong_app/base/base_state_widget.dart';
|
||||
import 'package:qinglong_app/base/routes.dart';
|
||||
import 'package:qinglong_app/base/sp_const.dart';
|
||||
import 'package:qinglong_app/base/theme.dart';
|
||||
import 'package:qinglong_app/base/ui/abs_underline_tabindicator.dart';
|
||||
import 'package:qinglong_app/base/ui/empty_widget.dart';
|
||||
import 'package:qinglong_app/main.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:qinglong_app/utils/sp_utils.dart';
|
||||
|
||||
import '../../base/ui/syntax_highlighter.dart';
|
||||
import 'config_viewmodel.dart';
|
||||
@ -19,8 +24,7 @@ class ConfigPage extends StatefulWidget {
|
||||
ConfigPageState createState() => ConfigPageState();
|
||||
}
|
||||
|
||||
class ConfigPageState extends State<ConfigPage>
|
||||
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
||||
class ConfigPageState extends State<ConfigPage> with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
||||
int _initIndex = 0;
|
||||
BuildContext? childContext;
|
||||
|
||||
@ -85,14 +89,8 @@ class ConfigPageState extends State<ConfigPage>
|
||||
void editMe(WidgetRef ref) {
|
||||
if (childContext == null) return;
|
||||
navigatorState.currentState?.pushNamed(Routes.routeConfigEdit, arguments: {
|
||||
"title": ref
|
||||
.read(configProvider)
|
||||
.list[DefaultTabController.of(childContext!)?.index ?? 0]
|
||||
.title,
|
||||
"content": ref.read(configProvider).content[ref
|
||||
.read(configProvider)
|
||||
.list[DefaultTabController.of(childContext!)?.index ?? 0]
|
||||
.title]
|
||||
"title": ref.read(configProvider).list[DefaultTabController.of(childContext!)?.index ?? 0].title,
|
||||
"content": ref.read(configProvider).content[ref.read(configProvider).list[DefaultTabController.of(childContext!)?.index ?? 0].title]
|
||||
}).then((value) async {
|
||||
if (value != null && (value as String).isNotEmpty) {
|
||||
await ref.read(configProvider).loadContent(value);
|
||||
@ -105,7 +103,7 @@ class ConfigPageState extends State<ConfigPage>
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
||||
|
||||
class CodeWidget extends StatefulWidget {
|
||||
class CodeWidget extends ConsumerStatefulWidget {
|
||||
final String content;
|
||||
|
||||
const CodeWidget({
|
||||
@ -114,30 +112,61 @@ class CodeWidget extends StatefulWidget {
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<CodeWidget> createState() => _CodeWidgetState();
|
||||
ConsumerState<CodeWidget> createState() => _CodeWidgetState();
|
||||
}
|
||||
|
||||
class _CodeWidgetState extends State<CodeWidget>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
class _CodeWidgetState extends ConsumerState<CodeWidget> with AutomaticKeepAliveClientMixin {
|
||||
CodeController? _codeController;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_codeController?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
String result = "";
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
result = widget.content;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return SelectableText.rich(
|
||||
TextSpan(
|
||||
style: GoogleFonts.droidSansMono(fontSize: 14).apply(
|
||||
fontSizeFactor: 1,
|
||||
_codeController ??= CodeController(
|
||||
text: result,
|
||||
language: powershell,
|
||||
onChange: (value) {
|
||||
result = value;
|
||||
},
|
||||
theme: ref.watch(themeProvider).themeColor.codeEditorTheme(),
|
||||
stringMap: {
|
||||
"export": const TextStyle(fontWeight: FontWeight.normal, color: Color(0xff6B2375)),
|
||||
},
|
||||
);
|
||||
return SafeArea(
|
||||
top: false,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: SpUtil.getBool(spShowLine, defValue: false) ? 0 : 10,
|
||||
),
|
||||
children: <TextSpan>[
|
||||
DartSyntaxHighlighter(SyntaxHighlighterStyle.lightThemeStyle())
|
||||
.format(widget.content)
|
||||
],
|
||||
),
|
||||
style: DefaultTextStyle.of(context).style.apply(
|
||||
fontSizeFactor: 1,
|
||||
child: CodeField(
|
||||
controller: _codeController!,
|
||||
expands: true,
|
||||
readOnly: true,
|
||||
background: Colors.white,
|
||||
wrap: SpUtil.getBool(spShowLine, defValue: false) ? false : true,
|
||||
hideColumn: !SpUtil.getBool(spShowLine, defValue: false),
|
||||
lineNumberStyle: LineNumberStyle(
|
||||
textStyle: TextStyle(
|
||||
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
selectionWidthStyle: BoxWidthStyle.max,
|
||||
selectionHeightStyle: BoxHeightStyle.max,
|
||||
autofocus: true,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -2,10 +2,12 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:qinglong_app/base/routes.dart';
|
||||
import 'package:qinglong_app/base/sp_const.dart';
|
||||
import 'package:qinglong_app/base/theme.dart';
|
||||
import 'package:qinglong_app/base/userinfo_viewmodel.dart';
|
||||
import 'package:qinglong_app/main.dart';
|
||||
import 'package:qinglong_app/utils/extension.dart';
|
||||
import 'package:qinglong_app/utils/sp_utils.dart';
|
||||
|
||||
class OtherPage extends ConsumerStatefulWidget {
|
||||
const OtherPage({Key? key}) : super(key: key);
|
||||
@ -175,6 +177,7 @@ class _OtherPageState extends ConsumerState<OtherPage> {
|
||||
const Divider(
|
||||
indent: 15,
|
||||
),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (getIt<UserInfoViewModel>().useSecretLogined) {
|
||||
@ -251,10 +254,42 @@ class _OtherPageState extends ConsumerState<OtherPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const Divider(
|
||||
indent: 15,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15,
|
||||
right: 15,
|
||||
bottom: 5,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"查看代码是否显示行号",
|
||||
style: TextStyle(
|
||||
color: ref.watch(themeProvider).themeColor.titleColor(),
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
CupertinoSwitch(
|
||||
activeColor: ref.watch(themeProvider).primaryColor,
|
||||
value: SpUtil.getBool(spShowLine, defValue: false),
|
||||
onChanged: (open) async {
|
||||
await SpUtil.putBool(spShowLine, open);
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(
|
||||
indent: 15,
|
||||
height: 1,
|
||||
),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
@ -265,7 +300,7 @@ class _OtherPageState extends ConsumerState<OtherPage> {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 15,
|
||||
vertical: 5,
|
||||
vertical: 10,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
@ -1,20 +1,22 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:code_text_field/code_text_field.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:highlight/languages/javascript.dart';
|
||||
import 'package:highlight/languages/json.dart';
|
||||
import 'package:highlight/languages/powershell.dart';
|
||||
import 'package:highlight/languages/python.dart';
|
||||
import 'package:highlight/languages/vbscript-html.dart';
|
||||
import 'package:highlight/languages/yaml.dart';
|
||||
import 'package:qinglong_app/base/http/api.dart';
|
||||
import 'package:qinglong_app/base/http/http.dart';
|
||||
import 'package:qinglong_app/base/ql_app_bar.dart';
|
||||
import 'package:qinglong_app/base/routes.dart';
|
||||
import 'package:qinglong_app/base/sp_const.dart';
|
||||
import 'package:qinglong_app/base/theme.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:qinglong_app/base/ui/lazy_load_state.dart';
|
||||
import 'package:qinglong_app/utils/extension.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import '../../../base/ui/syntax_highlighter.dart';
|
||||
import '../../config/config_page.dart';
|
||||
import 'package:qinglong_app/utils/sp_utils.dart';
|
||||
|
||||
/// @author NewTab
|
||||
class ScriptDetailPage extends ConsumerStatefulWidget {
|
||||
@ -31,11 +33,62 @@ class ScriptDetailPage extends ConsumerStatefulWidget {
|
||||
_ScriptDetailPageState createState() => _ScriptDetailPageState();
|
||||
}
|
||||
|
||||
class _ScriptDetailPageState extends ConsumerState<ScriptDetailPage>
|
||||
with LazyLoadState<ScriptDetailPage> {
|
||||
class _ScriptDetailPageState extends ConsumerState<ScriptDetailPage> with LazyLoadState<ScriptDetailPage> {
|
||||
String? content;
|
||||
CodeController? _codeController;
|
||||
GlobalKey<CodeFieldState> codeFieldKey = GlobalKey();
|
||||
|
||||
List<Widget> actions = [];
|
||||
bool buttonshow = false;
|
||||
|
||||
void scrollToTop() {
|
||||
codeFieldKey.currentState?.getCodeScroll()?.animateTo(0, duration: const Duration(milliseconds: 200), curve: Curves.linear);
|
||||
}
|
||||
|
||||
void floatingButtonVisibility() {
|
||||
double y = codeFieldKey.currentState?.getCodeScroll()?.offset ?? 0;
|
||||
if (y > MediaQuery.of(context).size.height / 2) {
|
||||
if (buttonshow == true) return;
|
||||
setState(() {
|
||||
buttonshow = true;
|
||||
});
|
||||
} else {
|
||||
if (buttonshow == false) return;
|
||||
setState(() {
|
||||
buttonshow = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
String suffix = "\n\n\n";
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_codeController?.dispose();
|
||||
_codeController = null;
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
getLanguageType(String title) {
|
||||
if (title.endsWith(".js")) {
|
||||
return javascript;
|
||||
}
|
||||
|
||||
if (title.endsWith(".sh")) {
|
||||
return powershell;
|
||||
}
|
||||
|
||||
if (title.endsWith(".py")) {
|
||||
return python;
|
||||
}
|
||||
if (title.endsWith(".json")) {
|
||||
return json;
|
||||
}
|
||||
if (title.endsWith(".yaml")) {
|
||||
return yaml;
|
||||
}
|
||||
return vbscriptHtml;
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -85,6 +138,7 @@ class _ScriptDetailPageState extends ConsumerState<ScriptDetailPage>
|
||||
Navigator.of(context).pop();
|
||||
|
||||
showCupertinoDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: const Text("确认删除"),
|
||||
@ -110,8 +164,7 @@ class _ScriptDetailPageState extends ConsumerState<ScriptDetailPage>
|
||||
),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
HttpResponse<NullResponse> result =
|
||||
await Api.delScript(widget.title, widget.path ?? "");
|
||||
HttpResponse<NullResponse> result = await Api.delScript(widget.title, widget.path ?? "");
|
||||
if (result.success) {
|
||||
"删除成功".toast();
|
||||
Navigator.of(context).pop(true);
|
||||
@ -147,18 +200,44 @@ class _ScriptDetailPageState extends ConsumerState<ScriptDetailPage>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (content != null) {
|
||||
_codeController ??= CodeController(
|
||||
text: (content ?? "") + suffix,
|
||||
language: getLanguageType(widget.title),
|
||||
onChange: (value) {
|
||||
content = value + suffix;
|
||||
},
|
||||
theme: ref.watch(themeProvider).themeColor.codeEditorTheme(),
|
||||
stringMap: {
|
||||
"export": const TextStyle(fontWeight: FontWeight.normal, color: Color(0xff6B2375)),
|
||||
},
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
floatingActionButton: Visibility(
|
||||
visible: buttonshow,
|
||||
child: FloatingActionButton(
|
||||
mini: true,
|
||||
onPressed: () {
|
||||
scrollToTop();
|
||||
},
|
||||
elevation: 2,
|
||||
backgroundColor: Colors.white,
|
||||
child: const Icon(CupertinoIcons.up_arrow),
|
||||
),
|
||||
),
|
||||
appBar: QlAppBar(
|
||||
canBack: true,
|
||||
backCall: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
title: "脚本详情",
|
||||
title: widget.title,
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showCupertinoModalPopup(
|
||||
context: context,
|
||||
useRootNavigator: false,
|
||||
builder: (context) {
|
||||
return CupertinoActionSheet(
|
||||
title: Container(
|
||||
@ -217,11 +296,31 @@ class _ScriptDetailPageState extends ConsumerState<ScriptDetailPage>
|
||||
),
|
||||
body: content == null
|
||||
? const Center(
|
||||
child: CupertinoActivityIndicator(),
|
||||
)
|
||||
: ScriptCodeWidget(
|
||||
content: content ?? "",
|
||||
child: CupertinoActivityIndicator(),
|
||||
)
|
||||
: SafeArea(
|
||||
top: false,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: SpUtil.getBool(spShowLine, defValue: false) ? 0 : 10,
|
||||
),
|
||||
child: CodeField(
|
||||
key: codeFieldKey,
|
||||
controller: _codeController!,
|
||||
expands: true,
|
||||
readOnly: true,
|
||||
wrap: SpUtil.getBool(spShowLine, defValue: false) ? false : true,
|
||||
hideColumn: !SpUtil.getBool(spShowLine, defValue: false),
|
||||
lineNumberStyle: LineNumberStyle(
|
||||
textStyle: TextStyle(
|
||||
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
background: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -234,71 +333,21 @@ class _ScriptDetailPageState extends ConsumerState<ScriptDetailPage>
|
||||
if (response.success) {
|
||||
content = response.bean;
|
||||
setState(() {});
|
||||
Future.delayed(
|
||||
const Duration(
|
||||
seconds: 1,
|
||||
),
|
||||
() {
|
||||
codeFieldKey.currentState?.getCodeScroll()?.addListener(floatingButtonVisibility);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
response.message?.toast();
|
||||
}
|
||||
}
|
||||
|
||||
getLanguageType(String title) {
|
||||
if (title.endsWith(".js")) {
|
||||
return "js";
|
||||
}
|
||||
|
||||
if (title.endsWith(".sh")) {
|
||||
return "sh";
|
||||
}
|
||||
|
||||
if (title.endsWith(".py")) {
|
||||
return "py";
|
||||
}
|
||||
if (title.endsWith(".json")) {
|
||||
return "json";
|
||||
}
|
||||
if (title.endsWith(".yaml")) {
|
||||
return "yaml";
|
||||
}
|
||||
return "html";
|
||||
}
|
||||
|
||||
@override
|
||||
void onLazyLoad() {
|
||||
loadData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ScriptCodeWidget extends StatefulWidget {
|
||||
final String content;
|
||||
|
||||
const ScriptCodeWidget({
|
||||
Key? key,
|
||||
required this.content,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ScriptCodeWidget> createState() => _ScriptCodeWidgetState();
|
||||
}
|
||||
|
||||
class _ScriptCodeWidgetState extends State<ScriptCodeWidget>{
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SelectableText.rich(
|
||||
TextSpan(
|
||||
style: GoogleFonts.droidSansMono(fontSize: 14).apply(
|
||||
fontSizeFactor: 1,
|
||||
),
|
||||
children: <TextSpan>[
|
||||
DartSyntaxHighlighter(SyntaxHighlighterStyle.lightThemeStyle())
|
||||
.format(widget.content)
|
||||
],
|
||||
),
|
||||
style: DefaultTextStyle.of(context).style.apply(
|
||||
fontSizeFactor: 1,
|
||||
),
|
||||
selectionWidthStyle: BoxWidthStyle.max,
|
||||
selectionHeightStyle: BoxHeightStyle.max,
|
||||
autofocus: true,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:code_text_field/code_text_field.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:highlight/languages/javascript.dart';
|
||||
@ -10,8 +11,10 @@ import 'package:highlight/languages/yaml.dart';
|
||||
import 'package:qinglong_app/base/http/api.dart';
|
||||
import 'package:qinglong_app/base/http/http.dart';
|
||||
import 'package:qinglong_app/base/ql_app_bar.dart';
|
||||
import 'package:qinglong_app/base/sp_const.dart';
|
||||
import 'package:qinglong_app/base/theme.dart';
|
||||
import 'package:qinglong_app/utils/extension.dart';
|
||||
import 'package:qinglong_app/utils/sp_utils.dart';
|
||||
|
||||
class ScriptEditPage extends ConsumerStatefulWidget {
|
||||
final String content;
|
||||
@ -28,6 +31,7 @@ class _ScriptEditPageState extends ConsumerState<ScriptEditPage> {
|
||||
CodeController? _codeController;
|
||||
late String result;
|
||||
FocusNode focusNode = FocusNode();
|
||||
late String preResult;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
@ -38,7 +42,7 @@ class _ScriptEditPageState extends ConsumerState<ScriptEditPage> {
|
||||
@override
|
||||
void initState() {
|
||||
result = widget.content;
|
||||
|
||||
preResult = widget.content;
|
||||
super.initState();
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
@ -84,7 +88,45 @@ class _ScriptEditPageState extends ConsumerState<ScriptEditPage> {
|
||||
appBar: QlAppBar(
|
||||
canBack: true,
|
||||
backCall: () {
|
||||
Navigator.of(context).pop();
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
|
||||
if (preResult == result) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
useRootNavigator: false,
|
||||
builder: (childContext) => CupertinoAlertDialog(
|
||||
title: const Text("温馨提示"),
|
||||
content: const Text("你编辑的内容还没用提交,确定退出吗?"),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: const Text(
|
||||
"取消",
|
||||
style: TextStyle(
|
||||
color: Color(0xff999999),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(childContext).pop();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
"确定",
|
||||
style: TextStyle(
|
||||
color: ref.watch(themeProvider).primaryColor,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(childContext).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
title: '编辑${widget.title}',
|
||||
actions: [
|
||||
@ -117,19 +159,23 @@ class _ScriptEditPageState extends ConsumerState<ScriptEditPage> {
|
||||
),
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
child: CodeField(
|
||||
controller: _codeController!,
|
||||
expands: true,
|
||||
wrap: true,
|
||||
lineNumberStyle: const LineNumberStyle(
|
||||
width: 0,
|
||||
margin: 0,
|
||||
textStyle: TextStyle(
|
||||
color: Colors.transparent,
|
||||
fontSize: 0,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: SpUtil.getBool(spShowLine, defValue: false) ? 0 : 10,
|
||||
),
|
||||
child: CodeField(
|
||||
controller: _codeController!,
|
||||
expands: true,
|
||||
background: Colors.white,
|
||||
wrap: SpUtil.getBool(spShowLine, defValue: false) ? false : true,
|
||||
hideColumn: !SpUtil.getBool(spShowLine, defValue: false),
|
||||
lineNumberStyle: LineNumberStyle(
|
||||
textStyle: TextStyle(
|
||||
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
background: ref.watch(themeProvider).themeColor.tabBarColor(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
74
pub/code_field-master/.gitignore
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
.dart_tool/
|
||||
.flutter-plugins
|
||||
.flutter-plugins-dependencies
|
||||
.packages
|
||||
.pub-cache/
|
||||
.pub/
|
||||
build/
|
||||
|
||||
# Android related
|
||||
**/android/**/gradle-wrapper.jar
|
||||
**/android/.gradle
|
||||
**/android/captures/
|
||||
**/android/gradlew
|
||||
**/android/gradlew.bat
|
||||
**/android/local.properties
|
||||
**/android/**/GeneratedPluginRegistrant.java
|
||||
|
||||
# iOS/XCode related
|
||||
**/ios/**/*.mode1v3
|
||||
**/ios/**/*.mode2v3
|
||||
**/ios/**/*.moved-aside
|
||||
**/ios/**/*.pbxuser
|
||||
**/ios/**/*.perspectivev3
|
||||
**/ios/**/*sync/
|
||||
**/ios/**/.sconsign.dblite
|
||||
**/ios/**/.tags*
|
||||
**/ios/**/.vagrant/
|
||||
**/ios/**/DerivedData/
|
||||
**/ios/**/Icon?
|
||||
**/ios/**/Pods/
|
||||
**/ios/**/.symlinks/
|
||||
**/ios/**/profile
|
||||
**/ios/**/xcuserdata
|
||||
**/ios/.generated/
|
||||
**/ios/Flutter/App.framework
|
||||
**/ios/Flutter/Flutter.framework
|
||||
**/ios/Flutter/Flutter.podspec
|
||||
**/ios/Flutter/Generated.xcconfig
|
||||
**/ios/Flutter/app.flx
|
||||
**/ios/Flutter/app.zip
|
||||
**/ios/Flutter/flutter_assets/
|
||||
**/ios/Flutter/flutter_export_environment.sh
|
||||
**/ios/ServiceDefinitions.json
|
||||
**/ios/Runner/GeneratedPluginRegistrant.*
|
||||
|
||||
# Exceptions to above rules.
|
||||
!**/ios/**/default.mode1v3
|
||||
!**/ios/**/default.mode2v3
|
||||
!**/ios/**/default.pbxuser
|
||||
!**/ios/**/default.perspectivev3
|
||||
10
pub/code_field-master/.metadata
Normal file
@ -0,0 +1,10 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
|
||||
channel: stable
|
||||
|
||||
project_type: package
|
||||
46
pub/code_field-master/CHANGELOG.md
Normal file
@ -0,0 +1,46 @@
|
||||
## [1.0.0-1] - 2021-03-06
|
||||
|
||||
* Initial release
|
||||
|
||||
## [1.0.0-4] - 2021-03-11
|
||||
|
||||
* Added horizontal scrolling support
|
||||
* Added code modifiers
|
||||
* Cleaner padding API
|
||||
|
||||
## [1.0.0-6] - 2021-03-12
|
||||
|
||||
* Added a temporary fix for https://github.com/flutter/flutter/issues/77929
|
||||
|
||||
## [1.0.0-7] - 2021-03-12
|
||||
|
||||
* Added a rawText getter to CodeController
|
||||
|
||||
## [1.0.0-9] - 2021-04-21
|
||||
|
||||
* Removed dependency on flutter_keyboard_visibility
|
||||
|
||||
## [1.0.1-0] - 2021-05-22
|
||||
|
||||
* TextEditingController.buildTextSpan breaking change migration for flutter 2.2.0
|
||||
|
||||
## [1.0.1-1] - 2021-06-04
|
||||
|
||||
* Added wrap paramerter to disable horizontal scrolling
|
||||
|
||||
## [1.0.1-2] - 2021-07-23
|
||||
|
||||
* Fixed highlight parsing on web (issue #11)
|
||||
|
||||
## [1.0.2] - 2021-07-23
|
||||
|
||||
* removeChar & removeSelection methods added
|
||||
* added onChange callback
|
||||
* added enabled flag
|
||||
* fixed middle dot issue
|
||||
|
||||
## [1.0.3] - 2022-05-02
|
||||
|
||||
* added onTap to CodeField API
|
||||
* fixed tab behavior in read-only mode
|
||||
* added setCursor method to CodeController
|
||||
21
pub/code_field-master/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Bertrand Bevillard
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
242
pub/code_field-master/README.md
Normal file
@ -0,0 +1,242 @@
|
||||
# CodeField
|
||||
|
||||
A customizable code text field supporting syntax highlighting
|
||||
|
||||
[](https://pub.dev/packages/code_text_field)
|
||||
[](https://bertrandbev.github.io/code_field/)
|
||||
[](https://raw.githubusercontent.com/BertrandBev/code_field/master/LICENSE)
|
||||
[](https://github.com/Solido/awesome-flutter)
|
||||
|
||||
<img src="https://raw.githubusercontent.com/BertrandBev/code_field/master/doc/images/top.gif" width="70%">
|
||||
|
||||
## Live demo
|
||||
|
||||
A [live demo](https://bertrandbev.github.io/code_field/#/) showcasing a few language / theme combinations
|
||||
|
||||
## Showcase
|
||||
|
||||
The experimental VM [dlox](https://github.com/BertrandBev/dlox) uses **CodeField** in its [online editor](https://bertrandbev.github.io/dlox/#/)
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
- Code highlight for 189 built-in languages with 90 themes thanks to [flutter_highlight](https://pub.dev/packages/flutter_highlight)
|
||||
- Easy language highlight customization through the use of theme maps
|
||||
- Fully customizable code field style through a TextField like API
|
||||
- Handles horizontal/vertical scrolling and vertical expansion
|
||||
- Supports code modifiers
|
||||
- Works on Android, iOS, and Web
|
||||
|
||||
Code modifiers help manage indents automatically
|
||||
|
||||
<img src="https://raw.githubusercontent.com/BertrandBev/code_field/master/doc/images/typing.gif" width="70%">
|
||||
|
||||
|
||||
The editor is wrapped in a horizontal scrollable container to handle long lines
|
||||
|
||||
|
||||
<img src="https://raw.githubusercontent.com/BertrandBev/code_field/master/doc/images/long_line.gif" width="70%">
|
||||
|
||||
|
||||
## Installing
|
||||
|
||||
In the `pubspec.yaml` of your flutter project, add the following dependency:
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
...
|
||||
code_text_field: <latest_version>
|
||||
```
|
||||
|
||||
[latest version](https://pub.dev/packages/code_text_field/install)
|
||||
|
||||
In your library add the following import:
|
||||
|
||||
```dart
|
||||
import 'package:code_text_field/code_field.dart';
|
||||
```
|
||||
|
||||
|
||||
## Simple example
|
||||
|
||||
A CodeField widget works with a **CodeController** which dynamically parses the text input according to a language and renders it with a theme map
|
||||
|
||||
```dart
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:code_text_field/code_field.dart';
|
||||
// Import the language & theme
|
||||
import 'package:highlight/languages/dart.dart';
|
||||
import 'package:flutter_highlight/themes/monokai-sublime.dart';
|
||||
|
||||
class CodeEditor extends StatefulWidget {
|
||||
@override
|
||||
_CodeEditorState createState() => _CodeEditorState();
|
||||
}
|
||||
|
||||
class _CodeEditorState extends State<CodeEditor> {
|
||||
CodeController? _codeController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final source = "void main() {\n print(\"Hello, world!\");\n}";
|
||||
// Instantiate the CodeController
|
||||
_codeController = CodeController(
|
||||
text: source,
|
||||
language: dart,
|
||||
theme: monokaiSublimeTheme,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_codeController?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CodeField(
|
||||
controller: _codeController!,
|
||||
textStyle: TextStyle(fontFamily: 'SourceCode'),
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<img src="https://raw.githubusercontent.com/BertrandBev/code_field/master/doc/images/example_0.png" width="60%">
|
||||
|
||||
Here, the monospace font [Source Code Pro](https://fonts.google.com/specimen/Source+Code+Pro?preview.text_type=custom) has been added to the assets folder and to the [pubspec.yaml](https://github.com/BertrandBev/code_field/blob/master/example/pubspec.yaml) file
|
||||
|
||||
|
||||
## Parser options
|
||||
|
||||
On top of a language definition, world-wise styling can be specified in the **stringMap** field
|
||||
|
||||
```dart
|
||||
_codeController = CodeController(
|
||||
//...
|
||||
stringMap: {
|
||||
"Hello": TextStyle(fontWeight: FontWeight.bold, color: Colors.red),
|
||||
"world": TextStyle(fontStyle: FontStyle.italic, color: Colors.green),
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
<img src="https://raw.githubusercontent.com/BertrandBev/code_field/master/doc/images/example_1.png" width="60%">
|
||||
|
||||
More complex regexes may also be used with the **patternMap**. When a language is used though, its regexes patterns take precedence over **patternMap** and **stringMap**.
|
||||
|
||||
```dart
|
||||
_codeController = CodeController(
|
||||
//...
|
||||
patternMap: {
|
||||
r"\B#[a-zA-Z0-9]+\b":
|
||||
TextStyle(fontWeight: FontWeight.bold, color: Colors.purpleAccent),
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
<img src="https://raw.githubusercontent.com/BertrandBev/code_field/master/doc/images/example_2.png" width="60%">
|
||||
|
||||
Both **patternMap** and **stringMap** can be used without specifying a language
|
||||
|
||||
```dart
|
||||
_codeController = CodeController(
|
||||
text: source,
|
||||
patternMap: {
|
||||
r'".*"': TextStyle(color: Colors.yellow),
|
||||
r'[a-zA-Z0-9]+\(.*\)': TextStyle(color: Colors.green),
|
||||
},
|
||||
stringMap: {
|
||||
"void": TextStyle(fontWeight: FontWeight.bold, color: Colors.red),
|
||||
"print": TextStyle(fontWeight: FontWeight.bold, color: Colors.blue),
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
<img src="https://raw.githubusercontent.com/BertrandBev/code_field/master/doc/images/example_3.png" width="60%">
|
||||
|
||||
|
||||
## Code Modifiers
|
||||
|
||||
Code modifiers can be created to react to special keystrokes.
|
||||
The default modifiers handle tab to space & automatic indentation. Here's the implementation of the default **TabModifier**
|
||||
|
||||
```dart
|
||||
class TabModifier extends CodeModifier {
|
||||
const TabModifier() : super('\t');
|
||||
|
||||
@override
|
||||
TextEditingValue? updateString(
|
||||
String text, TextSelection sel, EditorParams params) {
|
||||
final tmp = replace(text, sel.start, sel.end, " " * params.tabSpaces);
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### CodeField
|
||||
|
||||
```dart
|
||||
CodeField({
|
||||
Key? key,
|
||||
required this.controller,
|
||||
this.minLines,
|
||||
this.maxLines,
|
||||
this.expands = false,
|
||||
this.wrap = false,
|
||||
this.background,
|
||||
this.decoration,
|
||||
this.textStyle,
|
||||
this.padding = const EdgeInsets.symmetric(),
|
||||
this.lineNumberStyle = const LineNumberStyle(),
|
||||
this.enabled,
|
||||
this.cursorColor,
|
||||
this.textSelectionTheme,
|
||||
this.lineNumberBuilder,
|
||||
this.focusNode,
|
||||
this.onTap,
|
||||
})
|
||||
```
|
||||
|
||||
```dart
|
||||
LineNumberStyle({
|
||||
this.width = 42.0,
|
||||
this.textAlign = TextAlign.right,
|
||||
this.margin = 10.0,
|
||||
this.textStyle,
|
||||
this.background,
|
||||
})
|
||||
```
|
||||
|
||||
### CodeController
|
||||
|
||||
```dart
|
||||
CodeController({
|
||||
String? text,
|
||||
this.language,
|
||||
this.theme,
|
||||
this.patternMap,
|
||||
this.stringMap,
|
||||
this.params = const EditorParams(),
|
||||
this.modifiers = const <CodeModifier>[
|
||||
const IntendModifier(),
|
||||
const CloseBlockModifier(),
|
||||
const TabModifier(),
|
||||
],
|
||||
this.onChange,
|
||||
})
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
- Autocomplete disabling on android [doesn't work yet](https://github.com/flutter/flutter/issues/71679)
|
||||
- The TextField cursor doesn't seem to be handling space inputs properly on the web platform. Pending [issue resolution](https://github.com/flutter/flutter/issues/77929). The flag `webSpaceFix` fixes it by swapping spaces with transparent middle points.
|
||||
|
||||
## Notes
|
||||
|
||||
A [breaking change](https://flutter.dev/docs/release/breaking-changes/buildtextspan-buildcontext) to the `TextEditingController` was introduced in flutter beta, dev & master channels. The branch [beta](https://github.com/BertrandBev/code_field/tree/beta) should comply with those changes.
|
||||
15
pub/code_field-master/code_field.code-workspace
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"dart.vmAdditionalArgs": [
|
||||
"--no-sound-null-safety"
|
||||
],
|
||||
"dart.flutterRunAdditionalArgs": [
|
||||
"--no-sound-null-safety"
|
||||
]
|
||||
}
|
||||
}
|
||||
BIN
pub/code_field-master/doc/images/android.png
Normal file
|
After Width: | Height: | Size: 254 KiB |
BIN
pub/code_field-master/doc/images/example_0.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
pub/code_field-master/doc/images/example_1.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
pub/code_field-master/doc/images/example_2.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
pub/code_field-master/doc/images/example_3.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
pub/code_field-master/doc/images/long_line.gif
Normal file
|
After Width: | Height: | Size: 400 KiB |
BIN
pub/code_field-master/doc/images/top.gif
Normal file
|
After Width: | Height: | Size: 263 KiB |
BIN
pub/code_field-master/doc/images/typing.gif
Normal file
|
After Width: | Height: | Size: 100 KiB |
46
pub/code_field-master/example/.gitignore
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
**/ios/Flutter/.last_build_id
|
||||
.dart_tool/
|
||||
.flutter-plugins
|
||||
.flutter-plugins-dependencies
|
||||
.packages
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# Web related
|
||||
lib/generated_plugin_registrant.dart
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
# Obfuscation related
|
||||
app.*.map.json
|
||||
|
||||
# Android Studio will place build artifacts here
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
10
pub/code_field-master/example/.metadata
Normal file
@ -0,0 +1,10 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
|
||||
channel: stable
|
||||
|
||||
project_type: app
|
||||
11
pub/code_field-master/example/android/.gitignore
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
gradle-wrapper.jar
|
||||
/.gradle
|
||||
/captures/
|
||||
/gradlew
|
||||
/gradlew.bat
|
||||
/local.properties
|
||||
GeneratedPluginRegistrant.java
|
||||
|
||||
# Remember to never publicly share your keystore.
|
||||
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
|
||||
key.properties
|
||||
59
pub/code_field-master/example/android/app/build.gradle
Normal file
@ -0,0 +1,59 @@
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = rootProject.file('local.properties')
|
||||
if (localPropertiesFile.exists()) {
|
||||
localPropertiesFile.withReader('UTF-8') { reader ->
|
||||
localProperties.load(reader)
|
||||
}
|
||||
}
|
||||
|
||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||
if (flutterRoot == null) {
|
||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = '1'
|
||||
}
|
||||
|
||||
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||||
if (flutterVersionName == null) {
|
||||
flutterVersionName = '1.0'
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.example.example"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source '../..'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.example">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
@ -0,0 +1,41 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.example">
|
||||
<application
|
||||
android:label="example"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
<!-- Displays an Android View that continues showing the launch screen
|
||||
Drawable until Flutter paints its first frame, then this splash
|
||||
screen fades out. A splash screen is useful to avoid any visual
|
||||
gap between the end of Android's launch screen and the painting of
|
||||
Flutter's first frame. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.SplashScreenDrawable"
|
||||
android:resource="@drawable/launch_background"
|
||||
/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
</manifest>
|
||||
@ -0,0 +1,6 @@
|
||||
package com.example.example
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="?android:colorBackground" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 442 B |
|
After Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
Flutter draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
Flutter draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
@ -0,0 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.example">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
31
pub/code_field-master/example/android/build.gradle
Normal file
@ -0,0 +1,31 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.50'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.buildDir = '../build'
|
||||
subprojects {
|
||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||
}
|
||||
subprojects {
|
||||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
3
pub/code_field-master/example/android/gradle.properties
Normal file
@ -0,0 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
6
pub/code_field-master/example/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Fri Jun 23 08:50:38 CEST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
|
||||
11
pub/code_field-master/example/android/settings.gradle
Normal file
@ -0,0 +1,11 @@
|
||||
include ':app'
|
||||
|
||||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
||||
def properties = new Properties()
|
||||
|
||||
assert localPropertiesFile.exists()
|
||||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
||||
|
||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
||||
20
pub/code_field-master/example/deploy.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env sh
|
||||
# package.json "deploy": "yarn build; push-dir --dir=dist --branch=gh-pages --cleanup"
|
||||
|
||||
# abort on errors
|
||||
set -e
|
||||
|
||||
# build
|
||||
flutter build web --release --no-sound-null-safety
|
||||
|
||||
# navigate into the build output directory
|
||||
cd build/web
|
||||
|
||||
# Commit repo
|
||||
git init
|
||||
git add -A
|
||||
git commit -m 'deploy'
|
||||
git push -f git@github.com:BertrandBev/code_field.git master:gh-pages
|
||||
|
||||
# Nav back
|
||||
cd -
|
||||
32
pub/code_field-master/example/ios/.gitignore
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.moved-aside
|
||||
*.pbxuser
|
||||
*.perspectivev3
|
||||
**/*sync/
|
||||
.sconsign.dblite
|
||||
.tags*
|
||||
**/.vagrant/
|
||||
**/DerivedData/
|
||||
Icon?
|
||||
**/Pods/
|
||||
**/.symlinks/
|
||||
profile
|
||||
xcuserdata
|
||||
**/.generated/
|
||||
Flutter/App.framework
|
||||
Flutter/Flutter.framework
|
||||
Flutter/Flutter.podspec
|
||||
Flutter/Generated.xcconfig
|
||||
Flutter/app.flx
|
||||
Flutter/app.zip
|
||||
Flutter/flutter_assets/
|
||||
Flutter/flutter_export_environment.sh
|
||||
ServiceDefinitions.json
|
||||
Runner/GeneratedPluginRegistrant.*
|
||||
|
||||
# Exceptions to above rules.
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.pbxuser
|
||||
!default.perspectivev3
|
||||
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>App</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>io.flutter.flutter.app</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>App</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>8.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
2
pub/code_field-master/example/ios/Flutter/Debug.xcconfig
Normal file
@ -0,0 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
@ -0,0 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
41
pub/code_field-master/example/ios/Podfile
Normal file
@ -0,0 +1,41 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_ios_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
use_modular_headers!
|
||||
|
||||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_ios_build_settings(target)
|
||||
end
|
||||
end
|
||||
@ -0,0 +1,471 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
97C146EB1CF9000F007C117D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */,
|
||||
);
|
||||
name = Flutter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146E51CF9000F007C117D = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9740EEB11CF90186004384FC /* Flutter */,
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146EF1CF9000F007C117D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146F01CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
||||
97C147021CF9000F007C117D /* Info.plist */,
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
|
||||
);
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
97C146ED1CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Runner;
|
||||
productName = Runner;
|
||||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1020;
|
||||
ORGANIZATIONNAME = "";
|
||||
TargetAttributes = {
|
||||
97C146ED1CF9000F007C117D = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1100;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 97C146E51CF9000F007C117D;
|
||||
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
97C146ED1CF9000F007C117D /* Runner */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
97C146EC1CF9000F007C117D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Thin Binary";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
97C146EA1CF9000F007C117D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
97C146FB1CF9000F007C117D /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
97C147001CF9000F007C117D /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
249021D3217E4FDB00AE95B9 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
249021D4217E4FDB00AE95B9 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.example;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
97C147031CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
97C147041CF9000F007C117D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
97C147061CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.example;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
97C147071CF9000F007C117D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.example;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
97C147031CF9000F007C117D /* Debug */,
|
||||
97C147041CF9000F007C117D /* Release */,
|
||||
249021D3217E4FDB00AE95B9 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
97C147061CF9000F007C117D /* Debug */,
|
||||
97C147071CF9000F007C117D /* Release */,
|
||||
249021D4217E4FDB00AE95B9 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
}
|
||||
7
pub/code_field-master/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PreviewsEnabled</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Profile"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
7
pub/code_field-master/example/ios/Runner.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PreviewsEnabled</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
13
pub/code_field-master/example/ios/Runner/AppDelegate.swift
Normal file
@ -0,0 +1,13 @@
|
||||
import UIKit
|
||||
import Flutter
|
||||
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
override func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "83.5x83.5",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "Icon-App-1024x1024@1x.png",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 564 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
23
pub/code_field-master/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
pub/code_field-master/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
vendored
Normal file
|
After Width: | Height: | Size: 68 B |
BIN
pub/code_field-master/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 68 B |
BIN
pub/code_field-master/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 68 B |
5
pub/code_field-master/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# Launch Screen Assets
|
||||
|
||||
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
|
||||
|
||||
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
|
||||
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="LaunchImage" width="168" height="185"/>
|
||||
</resources>
|
||||
</document>
|
||||
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Flutter View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
45
pub/code_field-master/example/ios/Runner/Info.plist
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>example</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -0,0 +1 @@
|
||||
#import "GeneratedPluginRegistrant.h"
|
||||
373
pub/code_field-master/example/lib/code_snippets.dart
Normal file
@ -0,0 +1,373 @@
|
||||
// Copied from https://github.com/git-touch/highlight
|
||||
|
||||
const CODE_SNIPPETS = {
|
||||
'1c':
|
||||
'#ЗагрузитьИзФайла ext_module.txt // директива 7.7\n#Если Клиент ИЛИ НаКлиенте Тогда // инструкции препроцессора\n &НаКлиентеНаСервереБезКонтекста // директивы компиляции\n Функция ТолстыйКлиентОбычноеПриложение(Знач Параметр1 = Неопределено, // комментарий\n Параметр2 = "", ПараметрN = 123.45, ПарамNN) Экспорт // еще комментарий\n Попытка\n Результат_Булевы_Значения = Новый Структура("П1, П2", Истина, Ложь, NULL, Неопределено);\n Перейти ~МеткаGOTO; // комментарий\n РезультатТаблицаДат = Новый ТаблицаЗначений;\n РезультатТаблицаДат.Колонки.Добавить("Колонка1", \n Новый ОписаниеТипов("Дата", , ,\n Новый КвалификаторыДаты(ЧастиДаты.ДатаВремя));\n НС = РезультатТаблицаДат.Добавить(); НС["Колонка1"] = \'20170101120000\');\n Исключение\n ОписаниеОшибки = ОписаниеОшибки(); // встроенная функция\n Масс = Новый Массив; // встроенный тип\n Для Каждого Значение Из Масс Цикл\n Сообщить(Значение + Символы.ПС + "\n |продолжение строки"); // продолжение многострочной строки\n Продолжить; Прервать;\n КонецЦикла;\n СправочникСсылка = Справочники.Языки.НайтиПоНаименованию("ru"); // встроенные типы\n СправочникОбъект = СправочникСсылка.ПолучитьОбъект();\n ПеречислениеСсылка = Перечисления.ВидыМодификацииДанных.Изменен;\n ВызватьИсключение ОписаниеОшибки;\n КонецПопытки;\n ~МеткаGOTO: // еще комментарий\n ВД = ВидДвиженияБухгалтерии.Дебет;\n КонецФункции // ТолстыйКлиентОбычноеПриложение()\n#КонецЕсли',
|
||||
'abnf':
|
||||
'; line comment\n\nruleset = [optional] *(group1 / group2 / SP) CRLF ; trailing comment\n\ngroup1 = alt1\ngroup1 =/ alt2\n\nalt1 = %x41-4D / %d78-90\n\nalt2 = %b00100001\n\ngroup2 = *1DIGIT / 2*HEXDIG / 3*4OCTET\n\noptional = hex-codes\n / literal\n / sensitive\n / insensitive\n\nhex-codes = %x68.65.6C.6C.6F\nliteral = "string literal"\nsensitive = %s"case-sensitive string"\ninsensitive = %i"case-insensitive string"\n',
|
||||
'accesslog':
|
||||
'20.164.151.111 - - [20/Aug/2015:22:20:18 -0400] "GET /mywebpage/index.php HTTP/1.1" 403 772 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1"\n',
|
||||
'actionscript':
|
||||
'package org.example.dummy {\n import org.dummy.*;\n\n /*define package inline interface*/\n public interface IFooBarzable {\n public function foo(... pairs):Array;\n }\n\n public class FooBar implements IFooBarzable {\n static private var cnt:uint = 0;\n private var bar:String;\n\n //constructor\n public function TestBar(bar:String):void {\n bar = bar;\n ++cnt;\n }\n\n public function foo(... pairs):Array {\n pairs.push(bar);\n return pairs;\n }\n }\n}',
|
||||
'ada':
|
||||
'package body Sqlite.Simple is\n\n Foo : int := int\'Size;\n Bar : int := long\'Size;\n\n Error_Message_C : chars_ptr := Sqlite_Errstr (Error);\n Error_Message : String := Null_Ignore_Value (Error_Message_C);\n begin\n\n Named : for Index in Foo..Bar loop\n Put ("Hi[]{}");\n end loop Named;\n\n Foo := Bar;\n end Message;\n\nend Sqlite.Simple;\n',
|
||||
'angelscript':
|
||||
'interface IInterface\n{\n void DoSomething();\n}\n\nnamespace MyApplication\n{\n /*\n * This ia a test class.\n */\n class SomeClass : IInterface\n {\n array<float> m_arr;\n\n array<SomeClass@> m_children;\n array<array<SomeClass@>> m_subChildren; // Nested templates\n\n int m_thing;\n\n SomeClass()\n {\n // Add some integers\n m_arr.insertLast(1.0f);\n m_arr.insertLast(1.75f);\n m_arr.insertLast(3.14159f);\n uint x = 0x7fff0000;\n int y = 9001;\n }\n\n int get_Thing() property { return m_thing; }\n void set_Thing(int x) property { m_thing = x; }\n\n void DoSomething()\n {\n print("Something! " + \'stuff.\');\n for (uint i = 0; i < m_arr.length(); i++) {\n print(" " + i + ": " + m_arr[i]);\n }\n }\n\n protected void SomeProtectedFunction()\n {\n try {\n DoSomething();\n } catch {\n print("Exception while doing something!");\n }\n }\n }\n}\n\nvoid Main()\n{\n SomeClass@ c = SomeClass();\n c.DoSomething();\n}\n',
|
||||
'apache':
|
||||
'# rewrite`s rules for wordpress pretty url\nLoadModule rewrite_module modules/mod_rewrite.so\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . index.php [NC,L]\n\nExpiresActive On\nExpiresByType application/x-javascript "access plus 1 days"\n\nOrder Deny,Allow\nAllow from All\n\n<Location /maps/>\n RewriteMap map txt:map.txt\n RewriteMap lower int:tolower\n RewriteCond %{REQUEST_URI} ^/([^/.]+)\\.html\$ [NC]\n RewriteCond \${map:\${lower:%1}|NOT_FOUND} !NOT_FOUND\n RewriteRule .? /index.php?q=\${map:\${lower:%1}} [NC,L]\n</Location>\n',
|
||||
'applescript':
|
||||
'repeat 5 times\n if foo is greater than bar then\n display dialog "Hello there"\n else\n beep\n end if\nend repeat\n\n(* comment (*nested comment*) *)\non do_something(s, y)\n return {s + pi, y mod 4}\nend do_something\n\ndo shell script "/bin/echo \'hello\'"\n',
|
||||
'arcade':
|
||||
'/* Highlight.js est for Arcade */\nfunction testGeometry(element, point) {\n if (point.y != -1)\n return point;\n for (var i = 0 / 2; i < element.length; i++) {\n if (checkCondition(\$map.element[i]) === Infinity) {\n return DistanceGeodetic(element[i]);\n }\n }\n return element;\n}\nvar filePath = "literal " + TextFormatting.BackSlash + TextFormatting.SingleQuote + ".ext"\nvar d = Dictionary("field1", 1, "field2",2);\nreturn FeatureSet(\$map, ["POPULATION", "ELECTION-DATA"]);\n',
|
||||
'arduino':
|
||||
'/*\n Blink\n Turns on an LED on for one second, then off for one second, repeatedly.\n \n This example code is in the public domain.\n */\n \n// Pin 13 has an LED connected on most Arduino boards.\n// give it a name:\nint led = 13;\n\n// the setup routine runs once when you press reset:\nvoid setup() {\n // initialize the digital pin as an output.\n pinMode(led, OUTPUT); \n}\n\n// the loop routine runs over and over again forever:\nvoid loop() {\n digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)\n delay(1000); // wait for a second\n digitalWrite(led, LOW); // turn the LED off by making the voltage LOW\n delay(1000); // wait for a second\n}',
|
||||
'armasm':
|
||||
'.text\n\n.global connect\nconnect:\n mov r3, #2 ; s->sin_family = AF_INET\n strh r3, [sp]\n ldr r3, =server_port ; s->sin_port = server_port\n ldr r3, [r3]\n strh r3, [sp, #2]\n ldr r3, =server_addr ; s->sin_addr = server_addr\n ldr r3, [r3]\n str r3, [sp, #4]\n mov r3, #0 ; bzero(&s->sin_zero)\n str r3, [sp, #8]\n str r3, [sp, #12]\n mov r1, sp ; const struct sockaddr *addr = sp\n\n ldr r7, =connect_call\n ldr r7, [r7]\n swi #0\n\n add sp, sp, #16\n pop {r0} ; pop sockfd\n\n pop {r7}\n pop {fp, ip, lr}\n mov sp, ip\n bx lr\n\n.data\nsocket_call: .long 281\nconnect_call: .long 283\n\n/* all addresses are network byte-order (big-endian) */\nserver_addr: .long 0x0100007f ; localhost\nserver_port: .hword 0x0b1a\n',
|
||||
'asciidoc':
|
||||
'Hello, World!\n============\nAuthor Name, <author@domain.foo>\n\nyou can write text http://example.com[with links], optionally\nusing an explicit link:http://example.com[link prefix].\n\n* single quotes around a phrase place \'emphasis\'\n** alternatively, you can put underlines around a phrase to add _emphasis_\n* astericks around a phrase make the text *bold*\n* pluses around a phrase make it +monospaced+\n* `smart\' quotes using a leading backtick and trailing single quote\n** use two of each for double ``smart\'\' quotes\n\n- escape characters are supported\n- you can escape a quote inside emphasized text like \'here\\\'s johnny!\'\n\nterm:: definition\n another term:: another definition\n\n// this is just a comment\n\nLet\'s make a break.\n\n\'\'\'\n\n////\nwe\'ll be right with you\n\nafter this brief interruption.\n////\n\n== We\'re back!\n\nWant to see a image::images/tiger.png[Tiger]?\n\n.Nested highlighting\n++++\n<this_is inline="xml"></this_is>\n++++\n\n____\nasciidoc is so powerful.\n____\n\nanother quote:\n\n[quote, Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes]\n____\nWhen you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.\n____\n\nGetting Literal\n---------------\n\n want to get literal? prefix a line with a space.\n\n....\nI\'ll join that party, too.\n....\n\n. one thing (yeah!)\n. two thing `i can write code`, and `more` wipee!\n\nNOTE: AsciiDoc is quite cool, you should try it.',
|
||||
'aspectj':
|
||||
'package com.aspectj.syntax;\nimport org.aspectj.lang.annotation.AdviceName;\n\nprivileged public aspect LoggingAspect percflowbelow(ajia.services.*){\n private pointcut getResult() : call(* *(..) throws SQLException) && args(Account, .., int);\n @AdviceName("CheckValidEmail")\n before (Customer hu) : getResult(hu){ \n System.out.println("Your mail address is valid!");\n }\n Object around() throws InsufficientBalanceException: getResult() && call(Customer.new(String,String,int,int,int)){\n return proceed();\n }\n public Cache getCache() {\n return this.cache;\n }\n pointcut beanPropertyChange(BeanSupport bean, Object newValue): execution(void BeanSupport+.set*(*)) && args(newValue) && this(bean);\n declare parents: banking.entities.* implements BeanSupport;\n declare warning : call(void TestSoftening.perform()): "Please ensure you are not calling this from an AWT thread";\n private String Identifiable.id;\n public void Identifiable.setId(String id) {\n this.id = id;\n }\n}',
|
||||
'autohotkey':
|
||||
'; hotkeys and hotstrings\n#a::WinSet, AlwaysOnTop, Toggle, A\n#Space::\n MsgBox, Percent sign (`%) need to be escaped.\n Run "C:\\Program Files\\some\\program.exe"\n Gosub, label1\nreturn\n::btw::by the way\n; volume\n#Numpad8::Send {Volume_Up}\n#Numpad5::Send {Volume_Mute}\n#Numpad2::Send {Volume_Down}\n\nlabel1:\n if (Clipboard = "")\n {\n MsgBox, , Clipboard, Empty!\n }\n else\n {\n StringReplace, temp, Clipboard, old, new, All\n MsgBox, , Clipboard, %temp%\n }\nreturn\n',
|
||||
'autoit':
|
||||
'#NoTrayIcon\n#AutoIt3Wrapper_Run_Tidy=Y\n#include <Misc.au3>\n\n_Singleton(@ScriptName) ; Allow only one instance\nexample(0, 10)\n\nFunc example(\$min, \$max)\n For \$i = \$min To \$max\n If Mod(\$i, 2) == 0 Then\n MsgBox(64, "Message", \$i & \' is even number!\')\n Else\n MsgBox(64, "Message", \$i & \' is odd number!\')\n EndIf\n Next\nEndFunc ;==>example',
|
||||
'avrasm':
|
||||
';* Title: Block Copy Routines\n;* Version: 1.1\n\n.include "8515def.inc"\n\n rjmp RESET ;reset handle\n\n.def flashsize=r16 ;size of block to be copied\n\nflash2ram:\n lpm ;get constant\n st Y+,r0 ;store in SRAM and increment Y-pointer\n adiw ZL,1 ;increment Z-pointer\n dec flashsize\n brne flash2ram ;if not end of table, loop more\n ret\n\n.def ramtemp =r1 ;temporary storage register\n.def ramsize =r16 ;size of block to be copied\n',
|
||||
'awk':
|
||||
'BEGIN {\n POPService = "/inet/tcp/0/emailhost/pop3"\n RS = ORS = "\\r\\n"\n print "user name" |& POPService\n POPService |& getline\n print "pass password" |& POPService\n POPService |& getline\n print "retr 1" |& POPService\n POPService |& getline\n if (\$1 != "+OK") exit\n print "quit" |& POPService\n RS = "\\r\\n\\\\.\\r\\n"\n POPService |& getline\n print \$0\n close(POPService)\n}\n',
|
||||
'axapta':
|
||||
'class ExchRateLoadBatch extends RunBaseBatch {\n ExchRateLoad rbc;\n container currencies;\n boolean actual;\n boolean overwrite;\n date beg;\n date end;\n\n #define.CurrentVersion(5)\n\n #localmacro.CurrentList\n currencies,\n actual,\n beg,\n end\n #endmacro\n}\n\npublic boolean unpack(container packedClass) {\n container base;\n boolean ret;\n Integer version = runbase::getVersion(packedClass);\n\n switch (version) {\n case #CurrentVersion:\n [version, #CurrentList] = packedClass;\n return true;\n default:\n return false;\n }\n return ret;\n}\n',
|
||||
'bash':
|
||||
'#!/bin/bash\n\n###### CONFIG\nACCEPTED_HOSTS="/root/.hag_accepted.conf"\nBE_VERBOSE=false\n\nif [ "\$UID" -ne 0 ]\nthen\n echo "Superuser rights required"\n exit 2\nfi\n\ngenApacheConf(){\n echo -e "# Host \${HOME_DIR}\$1/\$2 :"\n}\n\necho \'"quoted"\' | tr -d \\" > text.txt\n',
|
||||
'basic':
|
||||
'10 CLS\n20 FOR I = 0 TO 15\n22 FOR J = 0 TO 7\n30 COLOR I,J\n40 PRINT " ** ";\n45 NEXT J\n46 COLOR I,0\n47 GOSUB 100\n48 PRINT\n50 NEXT I\n60 COLOR 15,0\n99 END\n100 FOR T = 65 TO 90\n101 PRINT CHR\$(T);\n102 NEXT T\n103 RETURN\n200 REM Data types test\n201 TOTAL# = 3.30# \'Double precision variable\n202 BALANCE! = 3! \'Single precision variable\n203 B2! = 12e5 \'120000\n204 ITEMS% = 10 \'Integer variable\n205 HEXTEST = &H12DB \'Hex value\n',
|
||||
'bnf':
|
||||
'<syntax> ::= <rule> | <rule> <syntax>\n<rule> ::= <opt-whitespace> "<" <rule-name> ">" <opt-whitespace> "::=" <opt-whitespace> <expression> <line-end>\n<opt-whitespace> ::= " " <opt-whitespace> | ""\n<expression> ::= <list> | <list> <opt-whitespace> "|" <opt-whitespace> <expression>\n<line-end> ::= <opt-whitespace> <EOL> | <line-end> <line-end>\n<list> ::= <term> | <term> <opt-whitespace> <list>\n<term> ::= <literal> | "<" <rule-name> ">"\n<literal> ::= \'"\' <text> \'"\' | "\'" <text> "\'"\n',
|
||||
'brainfuck':
|
||||
'++++++++++\n[ 3*10 and 10*10\n ->+++>++++++++++<<\n]>>\n[ filling cells\n ->++>>++>++>+>++>>++>++>++>++>++>++>++>++>++>++>++[</]<[<]<[<]>>\n]<\n+++++++++<<\n[ rough codes correction loop\n ->>>+>+>+>+++>+>+>+>+>+>+>+>+>+>+>+>+>+>+[<]<\n]\nmore accurate сodes correction\n>>>++>\n-->+++++++>------>++++++>++>+++++++++>++++++++++>++++++++>--->++++++++++>------>++++++>\n++>+++++++++++>++++++++++++>------>+++\nrewind and output\n[<]>[.>]\n',
|
||||
'cal':
|
||||
'OBJECT Codeunit 11 Gen. Jnl.-Check Line\n{\n OBJECT-PROPERTIES\n {\n Date=09-09-14;\n Time=12:00:00;\n Version List=NAVW18.00;\n }\n PROPERTIES\n {\n TableNo=81;\n Permissions=TableData 252=rimd;\n OnRun=BEGIN\n GLSetup.GET;\n RunCheck(Rec);\n END;\n\n }\n CODE\n {\n VAR\n Text000@1000 : TextConst \'ENU=can only be a closing date for G/L entries\';\n Text001@1001 : TextConst \'ENU=is not within your range of allowed posting dates\';\n\n PROCEDURE ErrorIfPositiveAmt@2(GenJnlLine@1000 : Record 81);\n BEGIN\n IF GenJnlLine.Amount > 0 THEN\n GenJnlLine.FIELDERROR(Amount,Text008);\n END;\n\n LOCAL PROCEDURE CheckGenJnlLineDocType@7(GenJnlLine@1001 : Record 81);\n }\n}\n',
|
||||
'capnproto':
|
||||
'@0xdbb9ad1f14bf0b36; # unique file ID, generated by `capnp id`\n\nstruct Person {\n name @0 :Text;\n birthdate @3 :Date;\n\n email @1 :Text;\n phones @2 :List(PhoneNumber);\n\n struct PhoneNumber {\n number @0 :Text;\n type @1 :Type;\n\n enum Type {\n mobile @0;\n home @1;\n work @2;\n }\n }\n}\n\nstruct Date {\n year @0 :Int16;\n month @1 :UInt8;\n day @2 :UInt8;\n flags @3 :List(Bool) = [ true, false, false, true ];\n}\n\ninterface Node {\n isDirectory @0 () -> (result :Bool);\n}\n\ninterface Directory extends(Node) {\n list @0 () -> (list: List(Entry));\n struct Entry {\n name @0 :Text;\n node @1 :Node;\n }\n\n create @1 (name :Text) -> (file :File);\n mkdir @2 (name :Text) -> (directory :Directory)\n open @3 (name :Text) -> (node :Node);\n delete @4 (name :Text);\n link @5 (name :Text, node :Node);\n}\n\ninterface File extends(Node) {\n size @0 () -> (size: UInt64);\n read @1 (startAt :UInt64 = 0, amount :UInt64 = 0xffffffffffffffff)\n -> (data: Data);\n # Default params = read entire file.\n\n write @2 (startAt :UInt64, data :Data);\n truncate @3 (size :UInt64);\n}',
|
||||
'ceylon':
|
||||
'shared void run() {\n print("Hello, `` process.arguments.first else "World" ``!");\n}\nclass Counter(count=0) {\n variable Integer count;\n shared Integer currentValue => count;\n shared void increment() => count++;\n}\n',
|
||||
'clean':
|
||||
'module fsieve\n\nimport StdClass; // RWS\nimport StdInt, StdReal\n\nNrOfPrimes :== 3000\n\nprimes :: [Int]\nprimes = pr where pr = [5 : sieve 7 4 pr]\n\nsieve :: Int !Int [Int] -> [Int]\nsieve g i prs\n| isPrime prs g (toInt (sqrt (toReal g))) = [g : sieve` g i prs]\n| otherwise = sieve (g + i) (6 - i) prs\n\nsieve` :: Int Int [Int] -> [Int]\nsieve` g i prs = sieve (g + i) (6 - i) prs\n\nisPrime :: [Int] !Int Int -> Bool\nisPrime [f:r] pr bd\n| f>bd = True\n| pr rem f==0 = False\n| otherwise = isPrime r pr bd\n\nselect :: [x] Int -> x\nselect [f:r] 1 = f\nselect [f:r] n = select r (n - 1)\n\nStart :: Int\nStart = select [2, 3 : primes] NrOfPrimes\n',
|
||||
'clojure':
|
||||
'(def ^:dynamic chunk-size 17)\n\n(defn next-chunk [rdr]\n (let [buf (char-array chunk-size)\n s (.read rdr buf)]\n (when (pos? s)\n (java.nio.CharBuffer/wrap buf 0 s))))\n\n(defn chunk-seq [rdr]\n (when-let [chunk (next-chunk rdr)]\n (cons chunk (lazy-seq (chunk-seq rdr)))))\n',
|
||||
'clojure-repl':
|
||||
'user=> (defn f [x y]\n #_=> (+ x y))\n#\'user/f\nuser=> (f 5 7)\n12\nuser=> nil\nnil\n',
|
||||
'cmake':
|
||||
'cmake_minimum_required(VERSION 2.8.8)\nproject(cmake_example)\n\n# Show message on Linux platform\nif (\${CMAKE_SYSTEM_NAME} MATCHES Linux)\n message("Good choice, bro!")\nendif()\n\n# Tell CMake to run moc when necessary:\nset(CMAKE_AUTOMOC ON)\n# As moc files are generated in the binary dir,\n# tell CMake to always look for includes there:\nset(CMAKE_INCLUDE_CURRENT_DIR ON)\n\n# Widgets finds its own dependencies.\nfind_package(Qt5Widgets REQUIRED)\n\nadd_executable(myproject main.cpp mainwindow.cpp)\nqt5_use_modules(myproject Widgets)\n',
|
||||
'coffeescript':
|
||||
'grade = (student, period=(if b? then 7 else 6)) ->\n if student.excellentWork\n "A+"\n else if student.okayStuff\n if student.triedHard then "B" else "B-"\n else\n "C"\n\nclass Animal extends Being\n constructor: (@name) ->\n\n move: (meters) ->\n alert @name + " moved #{meters}m."\n',
|
||||
'coq':
|
||||
'Inductive seq : nat -> Set :=\n| niln : seq 0\n| consn : forall n : nat, nat -> seq n -> seq (S n).\n\nFixpoint length (n : nat) (s : seq n) {struct s} : nat :=\n match s with\n | niln => 0\n | consn i _ s\' => S (length i s\')\n end.\n\nTheorem length_corr : forall (n : nat) (s : seq n), length n s = n.\nProof.\n intros n s.\n\n (* reasoning by induction over s. Then, we have two new goals\n corresponding on the case analysis about s (either it is\n niln or some consn *)\n induction s.\n\n (* We are in the case where s is void. We can reduce the\n term: length 0 niln *)\n simpl.\n\n (* We obtain the goal 0 = 0. *)\n trivial.\n\n (* now, we treat the case s = consn n e s with induction\n hypothesis IHs *)\n simpl.\n\n (* The induction hypothesis has type length n s = n.\n So we can use it to perform some rewriting in the goal: *)\n rewrite IHs.\n\n (* Now the goal is the trivial equality: S n = S n *)\n trivial.\n\n (* Now all sub cases are closed, we perform the ultimate\n step: typing the term built using tactics and save it as\n a witness of the theorem. *)\nQed.\n',
|
||||
'cos':
|
||||
'#dim test as %Library.Integer\nSET test = 123.099\nset ^global = %request.Content\nWrite "Current date """, \$ztimestamp, """, result: ", test + ^global = 125.099\ndo ##class(Cinema.Utils).AddShow("test") // class method call\ndo ##super() ; another one-line comment\nd:(^global = 2) ..thisClassMethod(1, 2, "test")\n/*\n * Sub-languages support:\n */\n&sql( SELECT * FROM Cinema.Film WHERE Length > 2 )\n&js<for (var i = 0; i < String("test").split("").length); ++i) {\n console.log(i);\n}>\n&html<<!DOCTYPE html>\n<html>\n<head> <meta name="test"/> </head>\n<body>Test</body>\n</html>>\n\nquit \$\$\$OK\n',
|
||||
'cpp':
|
||||
'#include <iostream>\n\nint main(int argc, char *argv[]) {\n\n /* An annoying "Hello World" example */\n for (auto i = 0; i < 0xFFFF; i++)\n cout << "Hello, World!" << endl;\n\n char c = \'\\n\';\n unordered_map <string, vector<string> > m;\n m["key"] = "\\\\\\\\"; // this is an error\n\n return -2e3 + 12l;\n}\n',
|
||||
'crmsh':
|
||||
'node webui\nnode 168633611: node1\nrsc_template web-server apache \\\n params port=8000 \\\n op monitor interval=10s\n# Never use this STONITH agent in production!\nprimitive development-stonith stonith:null \\\n params hostlist="webui node1 node2 node3"\nprimitive proxy systemd:haproxy \\\n op monitor interval=10s\nprimitive proxy-vip IPaddr2 \\\n params ip=10.13.37.20\nprimitive srv1 @web-server\nprimitive srv2 @web-server\nprimitive test1 Dummy\nprimitive test2 IPaddr2 \\\n params ip=10.13.37.99\nprimitive vip1 IPaddr2 \\\n params ip=10.13.37.21 \\\n op monitor interval=20s\nprimitive vip2 IPaddr2 \\\n params ip=10.13.37.22 \\\n op monitor interval=20s\ngroup g-proxy proxy-vip proxy\ngroup g-serv1 vip1 srv1\ngroup g-serv2 vip2 srv2\n# Never put the two web servers on the same node\ncolocation co-serv -inf: g-serv1 g-serv2\n# Never put any web server or haproxy on webui\nlocation l-avoid-webui { g-proxy g-serv1 g-serv2 } -inf: webui\n# Prever to spread groups across nodes\nlocation l-proxy g-proxy 200: node1\nlocation l-serv1 g-serv1 200: node2\nlocation l-serv2 g-serv2 200: node3\nproperty cib-bootstrap-options: \\\n stonith-enabled=true \\\n no-quorum-policy=ignore \\\n placement-strategy=balanced \\\n have-watchdog=false \\\n dc-version="1.1.13-1.1.13+git20150827.e8888b9" \\\n cluster-infrastructure=corosync \\\n cluster-name=hacluster\nrsc_defaults rsc-options: \\\n resource-stickiness=1 \\\n migration-threshold=3\nop_defaults op-options: \\\n timeout=600 \\\n record-pending=true\n',
|
||||
'crystal':
|
||||
'class Person\n def initialize(@name : String)\n end\n\n def greet\n puts "Hi, I\'m #{@name}"\n end\nend\n\nclass Employee < Person\nend\n\nemployee = Employee.new "John"\nemployee.greet # => "Hi, I\'m John"\nemployee.is_a?(Person) # => true\n\n@[Link("m")]\nlib C\n # In C: double cos(double x)\n fun cos(value : Float64) : Float64\nend\n\nC.cos(1.5_f64) # => 0.0707372\n\ns = uninitialized String\ns = <<-\'STR\'\n\\hello\\world\n\\hello\\world\nSTR\n',
|
||||
'cs':
|
||||
'using System.IO.Compression;\n\n#pragma warning disable 414, 3021\n\nnamespace MyApplication\n{\n [Obsolete("...")]\n class Program : IInterface\n {\n public static List<int> JustDoIt(int count)\n {\n Console.WriteLine(\$"Hello {Name}!");\n return new List<int>(new int[] { 1, 2, 3 })\n }\n }\n}\n',
|
||||
'csp':
|
||||
'Content-Security-Policy:\n default-src \'self\';\n style-src \'self\' css.example.com;\n img-src *.example.com;\n script-src \'unsafe-eval\' \'self\' js.example.com \'nonce-Nc3n83cnSAd3wc3Sasdfn939hc3\'\n',
|
||||
'css':
|
||||
'@font-face {\n font-family: Chunkfive; src: url(\'Chunkfive.otf\');\n}\n\nbody, .usertext {\n color: #F0F0F0; background: #600;\n font-family: Chunkfive, sans;\n --heading-1: 30px/32px Helvetica, sans-serif;\n}\n\n@import url(print.css);\n@media print {\n a[href^=http]::after {\n content: attr(href)\n }\n}\n',
|
||||
'd':
|
||||
'#!/usr/bin/rdmd\n// Computes average line length for standard input.\nimport std.stdio;\n\n/+\n this is a /+ nesting +/ comment\n+/\n\nenum COMPILED_ON = __TIMESTAMP__; // special token\n\nenum character = \'©\';\nenum copy_valid = \'©\';\nenum backslash_escaped = \'\\\\\';\n\n// string literals\nenum str = `hello "world"!`;\nenum multiline = r"lorem\nipsum\ndolor"; // wysiwyg string, no escapes here allowed\nenum multiline2 = "sit\namet\n\\"adipiscing\\"\nelit.";\nenum hex = x"66 6f 6f"; // same as "foo"\n\n#line 5\n\n// float literals\nenum f = [3.14f, .1, 1., 1e100, 0xc0de.01p+100];\n\nstatic if (something == true) {\n import std.algorithm;\n}\n\nvoid main() pure nothrow @safe {\n ulong lines = 0;\n double sumLength = 0;\n foreach (line; stdin.byLine()) {\n ++lines;\n sumLength += line.length;\n }\n writeln("Average line length: ",\n lines ? sumLength / lines : 0);\n}\n',
|
||||
'dart':
|
||||
'library app;\nimport \'dart:html\';\n\npart \'app2.dart\';\n\n/**\n * Class description and [link](http://dartlang.org/).\n */\n@Awesome(\'it works!\')\nclass SomeClass<S extends Iterable> extends BaseClass<S> implements Comparable {\n factory SomeClass(num param);\n SomeClass._internal(int q) : super() {\n assert(q != 1);\n double z = 0.0;\n }\n\n /// **Sum** function\n int sum(int a, int b) => a + b;\n\n ElementList els() => querySelectorAll(\'.dart\');\n}\n\nString str = \' (\${\'parameter\' + \'zxc\'})\';\nString str = " (\${true ? 2 + 2 / 2 : null})";\nString str = " (\$variable)";\nString str = r\'\\nraw\\\';\nString str = r"\\nraw\\";\nvar str = \'\'\'\nSomething \${2+3}\n\'\'\';\nvar str = r"""\nSomething \${2+3}\n""";\n\ncheckVersion() async {\n var version = await lookUpVersion();\n}\n',
|
||||
'delphi':
|
||||
'TList = Class(TObject)\nPrivate\n Some: String;\nPublic\n Procedure Inside; // Suxx\nEnd;{TList}\n\nProcedure CopyFile(InFileName, var OutFileName: String);\nConst\n BufSize = 4096; (* Huh? *)\nVar\n InFile, OutFile: TStream;\n Buffer: Array[1..BufSize] Of Byte;\n ReadBufSize: Integer;\nBegin\n InFile := Nil;\n OutFile := Nil;\n Try\n InFile := TFileStream.Create(InFileName, fmOpenRead);\n OutFile := TFileStream.Create(OutFileName, fmCreate);\n Repeat\n ReadBufSize := InFile.Read(Buffer, BufSize);\n OutFile.Write(Buffer, ReadBufSize);\n Until ReadBufSize<>BufSize;\n Log(\'File \'\'\' + InFileName + \'\'\' copied\'#13#10);\n Finally\n InFile.Free;\n OutFile.Free;\n End;{Try}\nEnd;{CopyFile}\n',
|
||||
'diff':
|
||||
'Index: languages/ini.js\n===================================================================\n--- languages/ini.js (revision 199)\n+++ languages/ini.js (revision 200)\n@@ -1,8 +1,7 @@\n hljs.LANGUAGES.ini =\n {\n case_insensitive: true,\n- defaultMode:\n- {\n+ defaultMode: {\n contains: [\'comment\', \'title\', \'setting\'],\n illegal: \'[^\\\\s]\'\n },\n\n*** /path/to/original timestamp\n--- /path/to/new timestamp\n***************\n*** 1,3 ****\n--- 1,9 ----\n+ This is an important\n+ notice! It should\n+ therefore be located at\n+ the beginning of this\n+ document!\n\n! compress the size of the\n! changes.\n\n It is important to spell\n',
|
||||
'django':
|
||||
'{% if articles|length %}\n{% for article in articles %}\n\n{% custom %}\n\n{# Striped table #}\n<tr class="{% cycle odd,even %}">\n <td>{{ article|default:"Hi... " }}</td>\n <td {% if article.today %}class="today"{% endif %}>\n Published on {{ article.date }}\n </td>\n</tr>\n\n{% endfor %}\n{% endif %}\n',
|
||||
'dns':
|
||||
'\$ORIGIN example.com. ; designates the start of this zone file in the namespace\n\$TTL 1h ; default expiration time of all resource records without their own TTL value\nexample.com. IN SOA ns.example.com. username.example.com. ( 2007120710 1d 2h 4w 1h )\nexample.com. IN NS ns ; ns.example.com is a nameserver for example.com\nexample.com. IN NS ns.somewhere.example. ; ns.somewhere.example is a backup nameserver for example.com\nexample.com. IN MX 10 mail.example.com. ; mail.example.com is the mailserver for example.com\n@ IN MX 20 mail2.example.com. ; equivalent to above line, "@" represents zone origin\n@ IN MX 50 mail3 ; equivalent to above line, but using a relative host name\nexample.com. IN A 192.0.2.1 ; IPv4 address for example.com\n IN AAAA 2001:db8:10::1 ; IPv6 address for example.com\nns IN A 192.0.2.2 ; IPv4 address for ns.example.com\n IN AAAA 2001:db8:10::2 ; IPv6 address for ns.example.com\nwww IN CNAME example.com. ; www.example.com is an alias for example.com\nwwwtest IN CNAME www ; wwwtest.example.com is another alias for www.example.com\nmail IN A 192.0.2.3 ; IPv4 address for mail.example.com\nmail2 IN A 192.0.2.4 ; IPv4 address for mail2.example.com\nmail3 IN A 192.0.2.5 ; IPv4 address for mail3.example.com\n',
|
||||
'dockerfile':
|
||||
'# Example instructions from https://docs.docker.com/reference/builder/\nFROM ubuntu:14.04\n\nMAINTAINER example@example.com\n\nENV foo /bar\nWORKDIR \${foo} # WORKDIR /bar\nADD . \$foo # ADD . /bar\nCOPY \\\$foo /quux # COPY \$foo /quux\nARG VAR=FOO\n\nRUN apt-get update && apt-get install -y software-properties-common\\\n zsh curl wget git htop\\\n unzip vim telnet\nRUN ["/bin/bash", "-c", "echo hello \${USER}"]\n\nCMD ["executable","param1","param2"]\nCMD command param1 param2\n\nEXPOSE 1337\n\nENV myName="John Doe" myDog=Rex\\ The\\ Dog \\\n myCat=fluffy\n\nENV myName John Doe\nENV myDog Rex The Dog\nENV myCat fluffy\n\nADD hom* /mydir/ # adds all files starting with "hom"\nADD hom?.txt /mydir/ # ? is replaced with any single character\n\nCOPY hom* /mydir/ # adds all files starting with "hom"\nCOPY hom?.txt /mydir/ # ? is replaced with any single character\nCOPY --from=foo / .\n\nENTRYPOINT ["executable", "param1", "param2"]\nENTRYPOINT command param1 param2\n\nVOLUME ["/data"]\n\nUSER daemon\n\nLABEL com.example.label-with-value="foo"\nLABEL version="1.0"\nLABEL description="This text illustrates \\\nthat label-values can span multiple lines."\n\nWORKDIR /path/to/workdir\n\nONBUILD ADD . /app/src\n\nSTOPSIGNAL SIGKILL\n\nHEALTHCHECK --retries=3 cat /health\n\nSHELL ["/bin/bash", "-c"]\n',
|
||||
'dos':
|
||||
'cd \\\ncopy a b\nping 192.168.0.1\n@rem ping 192.168.0.1\nnet stop sharedaccess\ndel %tmp% /f /s /q\ndel %temp% /f /s /q\nipconfig /flushdns\ntaskkill /F /IM JAVA.EXE /T\n\ncd Photoshop/Adobe Photoshop CS3/AMT/\nif exist application.sif (\n ren application.sif _application.sif\n) else (\n ren _application.sif application.sif\n)\n\ntaskkill /F /IM proquota.exe /T\n\nsfc /SCANNOW\n\nset path = test\n\nxcopy %1\\*.* %2\n',
|
||||
'dsconfig':
|
||||
'# Create client connection policies\ndsconfig create-client-connection-policy \\\n --policy-name "Restrictive Client Connection Policy" \\\n --set "description:Restrictive Client Connection Policy" \\\n --set enabled:true --set evaluation-order-index:1000 \\\n --set "connection-criteria:User.0 Connection Criteria" \\\n --set maximum-concurrent-connections:2 \\\n --set "maximum-connection-duration:1 s" \\\n --set "maximum-idle-connection-duration:1 s" \\\n --set maximum-operation-count-per-connection:1000\ncreate-client-connection-policy \\\n --policy-name "Another Client Connection Policy" \\\n --set enabled:true --set evaluation-order-index:100 \\\n --set \'connection-criteria:User.1 Connection Criteria\' \\\n --reset maximum-concurrent-connections\n# Configure global ACIs\ndsconfig set-access-control-handler-prop \\\n --add global-aci:\'(target="ldap:///cn=config")(targetattr="*")(version 3.0; acl "Allow access to the config tree by cn=admin,c=us"; allow(all) groupdn="ldap:///cn=directory administrators,ou=groups,c=us";)\' \\\n --add global-aci:\'(target="ldap:///cn=monitor")(targetattr="*")(version 3.0; acl "Allow access to the monitor tree by cn=admin,c=us"; allow(all) groupdn="ldap:///cn=directory administrators,ou=groups,c=us";)\' \\\n --remove global-aci:\'(target="ldap:///cn=alerts")(targetattr="*")(version 3.0; acl "Allow access to the alerts tree by cn=admin,c=us"; allow(all) groupdn="ldap:///cn=directory administrators,ou=groups,c=us";)\'\n# Delete error logger\ndsconfig delete-log-publisher --publisher-name "File-Based Error Logger"\n',
|
||||
'dts':
|
||||
'/*\n * Copyright (C) 2011 - 2014 Xilinx\n *\n * This software is licensed under the terms of the GNU General Public\n * License version 2, as published by the Free Software Foundation, and\n * may be copied, distributed, and modified under those terms.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n */\n/include/ "skeleton.dtsi"\n\n/ {\n compatible = "xlnx,zynq-7000";\n\n pmu {\n compatible = "arm,cortex-a9-pmu";\n interrupts = <0 5 4>, <0 6 4>;\n interrupt-parent = <&intc>;\n reg = < 0xf8891000 0x1000 0xf8893000 0x1000 >;\n };\n\n regulator_vccpint: fixedregulator@0 {\n compatible = "regulator-fixed";\n regulator-name = "VCCPINT";\n regulator-min-microvolt = <1000000>;\n regulator-max-microvolt = <1000000>;\n regulator-boot-on;\n regulator-always-on;\n };\n\n amba: amba {\n compatible = "simple-bus";\n #address-cells = <1>;\n #size-cells = <1>;\n interrupt-parent = <&intc>;\n ranges;\n\n adc: adc@f8007100 {\n compatible = "xlnx,zynq-xadc-1.00.a";\n reg = <0xf8007100 0x20>;\n interrupts = <0 7 4>;\n interrupt-parent = <&intc>;\n clocks = <&clkc 12>;\n };\n\n i2c0: i2c@e0004000 {\n compatible = "cdns,i2c-r1p10";\n status = "disabled";\n clocks = <&clkc 38>;\n interrupt-parent = <&intc>;\n interrupts = <0 25 4>;\n reg = <0xe0004000 0x1000>;\n #address-cells = <1>;\n #size-cells = <0>;\n };\n\n L2: cache-controller@f8f02000 {\n compatible = "arm,pl310-cache";\n reg = <0xF8F02000 0x1000>;\n interrupts = <0 2 4>;\n arm,data-latency = <3 2 2>;\n arm,tag-latency = <2 2 2>;\n cache-unified;\n cache-level = <2>;\n };\n\n };\n};\n',
|
||||
'dust':
|
||||
'<h3>Hours</h3>\n\n<ul>\n {#users}\n <li {hello}>{firstName}</li>{~n}\n {/users}\n</ul>\n',
|
||||
'ebnf':
|
||||
'(* line comment *)\n\nrule = [optional] , symbol , { letters } , ( digit | symbol ) ;\n\noptional = ? something unnecessary ? ; (* trailing comment *)\n\nsymbol = \'!\' | \'@\' | \'#\' | \'\$\' | \'%\' | \'&\' | \'*\' ;\ndigit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;\nletter = "A" | "B" | "C" | "D" | "E" | "F" | "G"\n | "H" | "I" | "J" | "K" | "L" | "M" | "N"\n | "O" | "P" | "Q" | "R" | "S" | "T" | "U"\n | "V" | "W" | "X" | "Y" | "Z" ;\n',
|
||||
'elixir':
|
||||
'defrecord Person, first_name: nil, last_name: "Dudington" do\n def name record do # huh ?\n "#{record.first_name} #{record.last_name}"\n end\nend\n\ndefrecord User, name: "José", age: 25\n\nguy = Person.new first_name: "Guy"\nguy.name\n\ndefmodule ListServer do\n @moduledoc """\n This module provides an easy to use ListServer, useful for keeping\n lists of things.\n """\n use GenServer.Behaviour\n alias Foo.Bar\n\n ### Public API\n @doc """\n Starts and links a new ListServer, returning {:ok, pid}\n\n ## Example\n\n iex> {:ok, pid} = ListServer.start_link\n\n """\n def start_link do\n :gen_server.start_link({:local, :list}, __MODULE__, [], [])\n end\n\n ### GenServer API\n def init(list) do\n {:ok, list}\n end\n\n # Clear the list\n def handle_cast :clear, list do\n {:noreply, []}\n end\nend\n\n{:ok, pid} = ListServer.start_link\npid <- {:foo, "bar"}\n\ngreeter = fn(x) -> IO.puts "hey #{x}" end\ngreeter.("Bob")\n\n',
|
||||
'elm':
|
||||
'import Browser\nimport Html exposing (div, button, text)\nimport Html.Events exposing (onClick)\n\ntype Msg\n = Increment\n\nmain =\n Browser.sandbox\n { init = 0\n , update = \\msg model -> model + 1\n , view = view\n }\n\nview model =\n div []\n [ div [] [ text (String.fromInt model) ]\n , button [ onClick Increment ] [ text "+" ]\n ]\n\nchars =\n String.cons \'C\' <| String.cons \'h\' <| "ars"\n',
|
||||
'erb':
|
||||
'<%# this is a comment %>\n\n<% @posts.each do |post| %>\n <p><%= link_to post.title, post %></p>\n<% end %>\n\n<%- available_things = things.select(&:available?) -%>\n<%%- x = 1 + 2 -%%>\n<%% value = \'real string #{@value}\' %%>\n<%%= available_things.inspect %%>\n',
|
||||
'erlang':
|
||||
'-module(ssh_cli).\n\n-behaviour(ssh_channel).\n\n-include("ssh.hrl").\n%% backwards compatibility\n-export([listen/1, listen/2, listen/3, listen/4, stop/1]).\n\nif L =/= [] -> % If L is not empty\n sum(L) / count(L);\ntrue ->\n error\nend.\n\n%% state\n-record(state, {\n cm,\n channel\n }).\n\n-spec foo(integer()) -> integer().\nfoo(X) -> 1 + X.\n\ntest(Foo)->Foo.\n\ninit([Shell, Exec]) ->\n {ok, #state{shell = Shell, exec = Exec}};\ninit([Shell]) ->\n false = not true,\n io:format("Hello, \\"~p!~n", [atom_to_list(\'World\')]),\n {ok, #state{shell = Shell}}.\n\nconcat([Single]) -> Single;\nconcat(RList) ->\n EpsilonFree = lists:filter(\n fun (Element) ->\n case Element of\n epsilon -> false;\n _ -> true\n end\n end,\n RList),\n case EpsilonFree of\n [Single] -> Single;\n Other -> {concat, Other}\n end.\n\nunion_dot_union({union, _}=U1, {union, _}=U2) ->\n union(lists:flatten(\n lists:map(\n fun (X1) ->\n lists:map(\n fun (X2) ->\n concat([X1, X2])\n end,\n union_to_list(U2)\n )\n end,\n union_to_list(U1)\n ))).\n',
|
||||
'erlang-repl':
|
||||
'1> Str = "abcd".\n"abcd"\n2> L = test:length(Str).\n4\n3> Descriptor = {L, list_to_atom(Str)}.\n{4,abcd}\n4> L.\n4\n5> b().\nDescriptor = {4,abcd}\nL = 4\nStr = "abcd"\nok\n6> f(L).\nok\n7> b().\nDescriptor = {4,abcd}\nStr = "abcd"\nok\n8> {L, _} = Descriptor.\n{4,abcd}\n9> L.\n4\n10> 2#101.\n5\n11> 1.85e+3.\n1850\n',
|
||||
'excel': '=IF(C10 <= 275.5, "Unprofitable", "Profitable")',
|
||||
'fix':
|
||||
'8=FIX.4.2␁9=0␁35=8␁49=SENDERTEST␁56=TARGETTEST␁34=00000001526␁52=20120429-13:30:08.137␁1=ABC12345␁11=2012abc1234␁14=100␁17=201254321␁20=0␁30=NYSE␁31=108.20␁32=100␁38=100␁39=2␁40=1␁47=A␁54=5␁55=BRK␁59=2␁60=20120429-13:30:08.000␁65=B␁76=BROKER␁84=0␁100=NYSE␁111=100␁150=2␁151=0␁167=CS␁377=N␁10000=SampleCustomTag␁10=123␁\n\n8=FIX.4.29=035=849=SENDERTEST56=TARGETTEST34=0000000152652=20120429-13:30:08.1371=ABC1234511=2012abc123414=10017=20125432120=030=NYSE31=108.2032=10038=10039=240=147=A54=555=BRK59=260=20120429-13:30:08.00065=B76=BROKER84=0100=NYSE111=100150=2151=0167=CS377=N10000=SampleCustomTag10=123\n',
|
||||
'flix':
|
||||
'/**\n * An example of Flix for syntax highlighting.\n */\n\n// Here is a namespace.\nnamespace a.b.c {\n\n // Here are some literals.\n def b: Bool = true\n def c: Char = \'a\'\n def f: Float = 1.23\n def i: Int = 42\n def s: Str = "string"\n\n // Here are some relations.\n rel LitStm(r: Str, c: Int)\n rel AddStm(r: Str, x: Str, y: Str)\n rel DivStm(r: Str, x: Str, y: Str)\n\n // Here is a lattice.\n lat LocalVar(k: Str, v: Constant)\n\n // Here is an index.\n index LitStm{{r}, {r, c}}\n\n // Here is an enum.\n enum Constant {\n case Top,\n\n case Cst(Int),\n\n case Bot\n }\n\n // Here is a function.\n def leq(e1: Constant, e2: Constant): Bool = match (e1, e2) with {\n case (Constant.Bot, _) => true\n case (Constant.Cst(n1), Constant.Cst(n2)) => n1 == n2\n case (_, Constant.Top) => true\n case _ => false\n }\n\n // Here are some rules.\n LocalVar(r, alpha(c)) :- LitStm(r, c).\n\n LocalVar(r, sum(v1, v2)) :- AddStm(r, x, y),\n LocalVar(x, v1),\n LocalVar(y, v2).\n}\n',
|
||||
'fortran':
|
||||
'subroutine test_sub(k)\n implicit none\n\n !===============================\n ! This is a test subroutine\n !===============================\n\n integer, intent(in) :: k\n double precision, allocatable :: a(:)\n integer, parameter :: nmax=10\n integer :: i\n\n allocate (a(nmax))\n\n do i=1,nmax\n a(i) = dble(i)*5.d0\n enddo\n\n print *, \'Hello world\'\n write (*,*) a(:)\n\nend subroutine test_sub\n',
|
||||
'fsharp':
|
||||
'open System\n\n// Single line comment...\n(*\n This is a\n multiline comment.\n*)\nlet checkList alist =\n match alist with\n | [] -> 0\n | [a] -> 1\n | [a; b] -> 2\n | [a; b; c] -> 3\n | _ -> failwith "List is too big!"\n\n\nlet text = "Some text..."\nlet text2 = @"A ""verbatim"" string..."\nlet catalog = """\nSome "long" string...\n"""\n\nlet rec fib x = if x <= 2 then 1 else fib(x-1) + fib(x-2)\n\nlet fibs =\n Async.Parallel [ for i in 0..40 -> async { return fib(i) } ]\n |> Async.RunSynchronously\n\ntype Sprocket(gears) =\n member this.Gears : int = gears\n\n[<AbstractClass>]\ntype Animal =\n abstract Speak : unit -> unit\n\ntype Widget =\n | RedWidget\n | GreenWidget\n\ntype Point = {X: float; Y: float;}\n\n[<Measure>]\ntype s\nlet minutte = 60<s>\n\ntype DefaultMailbox<\'a>() =\n let mutable inbox = ConcurrentQueue<\'a>()\n let awaitMsg = new AutoResetEvent(false)\n',
|
||||
'gams':
|
||||
'SETS\n I canning plants / SEATTLE, SAN-DIEGO /\n J markets / NEW-YORK, CHICAGO, TOPEKA / ;\nPARAMETERS\n A(I) capacity of plant i in cases\n / SEATTLE 350\n SAN-DIEGO 600 /\n B(J) demand at market j in cases\n / NEW-YORK 325\n CHICAGO 300\n TOPEKA 275 / ;\nTABLE D(I,J) distance in thousands of miles\n NEW-YORK CHICAGO TOPEKA\n SEATTLE 2.5 1.7 1.8\n SAN-DIEGO 2.5 1.8 1.4 ;\nSCALAR F freight in dollars per case per thousand miles /90/ ;\nPARAMETER C(I,J) transport cost in thousands of dollars per case ;\n C(I,J) = F * D(I,J) / 1000 ;\nVARIABLES\n X(I,J) shipment quantities in cases\n Z total transportation costs in thousands of dollars ;\nPOSITIVE VARIABLE X ;\nEQUATIONS\n COST define objective function\n SUPPLY(I) observe supply limit at plant i\n DEMAND(J) satisfy demand at market j ;\nCOST .. Z =E= SUM((I,J), C(I,J)*X(I,J)) ;\nSUPPLY(I) .. SUM(J, X(I,J)) =L= A(I) ;\nDEMAND(J) .. SUM(I, X(I,J)) =G= B(J) ;\nMODEL TRANSPORT /ALL/ ;\nSOLVE TRANSPORT USING LP MINIMIZING Z ;\n',
|
||||
'gauss':
|
||||
'// This is a test\n#include pv.sdf\n\nproc (1) = calc(local__row, fin);\n if local__row;\n nr = local__row;\n else;\n k = colsf(fin);\n nr = floor(minc(maxbytes/(k*8*3.5)|maxvec/(k+1)));\n endif;\n retp(nr);\nendp;\n\ns = "{% test string %}";\n\nfn twopi=pi*2;\n\n/* Takes in multiple numbers.\n Output sum */\nkeyword add(str);\n local tok,sum;\n sum = 0;\n do until str \$== "";\n { tok, str } = token(str);\n sum = sum + stof(tok);\n endo;\n print "Sum is: " sum;\nendp;\n',
|
||||
'gcode':
|
||||
'O003 (DIAMOND SQUARE)\nN2 G54 G90 G49 G80\nN3 M6 T1 (1.ENDMILL)\nN4 M3 S1800\nN5 G0 X-.6 Y2.050\nN6 G43 H1 Z.1\nN7 G1 Z-.3 F50.\nN8 G41 D1 Y1.45\nN9 G1 X0 F20.\nN10 G2 J-1.45\n(CUTTER COMP CANCEL)\nN11 G1 Z-.2 F50.\nN12 Y-.990\nN13 G40\nN14 G0 X-.6 Y1.590\nN15 G0 Z.1\nN16 M5 G49 G28 G91 Z0\nN17 CALL O9456\nN18 #500=0.004\nN19 #503=[#500+#501]\nN20 VC45=0.0006\nVS4=0.0007\nN21 G90 G10 L20 P3 X5.Y4. Z6.567\nN22 G0 X5000\nN23 IF [#1 LT 0.370] GOTO 49\nN24 X-0.678 Y+.990\nN25 G84.3 X-0.1\nN26 #4=#5*COS[45]\nN27 #4=#5*SIN[45]\nN28 VZOFZ=652.9658\n%\n',
|
||||
'gherkin':
|
||||
'# language: en\nFeature: Addition\n In order to avoid silly mistakes\n As a math idiot\n I want to be told the sum of two numbers\n\n @this_is_a_tag\n Scenario Outline: Add two numbers\n * I have a calculator\n Given I have entered <input_1> into the calculator\n And I have entered <input_2> into the calculator\n When I press <button>\n Then the result should be <output> on the screen\n And I have a string like\n """\n Here is\n some\n multiline text\n """\n\n Examples:\n | input_1 | input_2 | button | output |\n | 20 | 30 | add | 50 |\n | 2 | 5 | add | 7 |\n | 0 | 40 | add | 40 |\n',
|
||||
'glsl':
|
||||
'// vertex shader\n#version 150\nin vec2 in_Position;\nin vec3 in_Color;\n\nout vec3 ex_Color;\nvoid main(void) {\n gl_Position = vec4(in_Position.x, in_Position.y, 0.0, 1.0);\n ex_Color = in_Color;\n}\n\n\n// geometry shader\n#version 150\n\nlayout(triangles) in;\nlayout(triangle_strip, max_vertices = 3) out;\n\nvoid main() {\n for(int i = 0; i < gl_in.length(); i++) {\n gl_Position = gl_in[i].gl_Position;\n EmitVertex();\n }\n EndPrimitive();\n}\n\n\n// fragment shader\n#version 150\nprecision highp float;\n\nin vec3 ex_Color;\nout vec4 gl_FragColor;\n\nvoid main(void) {\n gl_FragColor = vec4(ex_Color, 1.0);\n}\n',
|
||||
'gml':
|
||||
'/// @description Collision code\n// standard collision handling\n\n// Horizontal collisions\nif(place_meeting(x+hspd, y, obj_wall)) {\n while(!place_meeting(x+sign(hspd), y, obj_wall)) {\n x += sign(hspd);\n }\n hspd = 0;\n}\nx += hspd;\n\n// Vertical collisions\nif(place_meeting(x, y+vspd, collide_obj)) {\n while(!place_meeting(x, y+sign(vspd), collide_obj)) {\n y += sign(vspd);\n }\n vspd = 0;\n}\ny += vspd;\n\nshow_debug_message("This is a test");',
|
||||
'go':
|
||||
'package main\n\nimport "fmt"\n\nfunc main() {\n ch := make(chan float64)\n ch <- 1.0e10 // magic number\n x, ok := <- ch\n defer fmt.Println(`exitting now\\`)\n go println(len("hello world!"))\n return\n}\n',
|
||||
'golo':
|
||||
'module hello\n\nfunction dyno = -> DynamicObject()\n\nstruct human = { name }\n\n@annotated\nfunction main = |args| {\n let a = 1\n var b = 2\n \n println("hello") \n\n let john = human("John Doe")\n}\n',
|
||||
'gradle':
|
||||
'\napply plugin: \'android\'\n\nandroid {\n compileSdkVersion 19\n buildToolsVersion "19.1"\n\n defaultConfig {\n minSdkVersion 15\n targetSdkVersion 19\n versionCode 5\n versionName "0.4.4"\n }\n\n compileOptions {\n sourceCompatibility JavaVersion.VERSION_1_7\n targetCompatibility JavaVersion.VERSION_1_7\n }\n signingConfigs {\n release\n }\n buildTypes {\n release {\n // runProguard true\n proguardFiles getDefaultProguardFile(\'proguard-android.txt\'), \'proguard-rules.txt\'\n signingConfig signingConfigs.release\n }\n }\n}\n\ndependencies {\n compile fileTree(dir: \'libs\', include: [\'*.jar\'])\n\n compile \'com.example:example-lib:1.0.0\'\n}\n\n\ndef propFile = file(\'../signing.properties\')\nif( propFile.canRead() ) {\n def Properties p = new Properties()\n p.load(new FileInputStream(propFile))\n\n if( p!=null\n && p.containsKey("STORE_FILE")\n && p.containsKey(\'STORE_PASSWORD\')\n && p.containsKey(\'KEY_ALIAS\')\n && p.containsKey(\'KEY_PASSWORD\')\n ) {\n println "RELEASE_BUILD: Signing..."\n\n android.signingConfigs.release.storeFile = file( p[\'STORE_FILE\'] )\n android.signingConfigs.release.storePassword = p[\'STORE_PASSWORD\']\n android.signingConfigs.release.keyAlias = p[\'KEY_ALIAS\']\n android.signingConfigs.release.keyPassword = p[\'KEY_PASSWORD\']\n } else {\n println "RELEASE_BUILD: Required properties in signing.properties are missing"\n android.buildTypes.release.signingConfig = null\n }\n} else {\n println "RELEASE_BUILD: signing.properties not found"\n android.buildTypes.release.signingProperties = null\n}\n',
|
||||
'groovy':
|
||||
'#!/usr/bin/env groovy\npackage model\n\nimport groovy.transform.CompileStatic\nimport java.util.List as MyList\n\ntrait Distributable {\n void distribute(String version) {}\n}\n\n@CompileStatic\nclass Distribution implements Distributable {\n double number = 1234.234 / 567\n def otherNumber = 3 / 4\n boolean archivable = condition ?: true\n def ternary = a ? b : c\n String name = "Guillaume"\n Closure description = null\n List<DownloadPackage> packages = []\n String regex = ~/.*foo.*/\n String multi = \'\'\'\n multi line string\n \'\'\' + """\n now with double quotes and \${gstring}\n """ + \$/\n even with dollar slashy strings\n /\$\n\n /**\n * description method\n * @param cl the closure\n */\n void description(Closure cl) { this.description = cl }\n\n void version(String name, Closure versionSpec) {\n def closure = { println "hi" } as Runnable\n\n MyList ml = [1, 2, [a: 1, b:2,c :3]]\n for (ch in "name") {}\n\n // single line comment\n DownloadPackage pkg = new DownloadPackage(version: name)\n\n check that: true\n\n label:\n def clone = versionSpec.rehydrate(pkg, pkg, pkg)\n /*\n now clone() in a multiline comment\n */\n clone()\n packages.add(pkg)\n\n assert 4 / 2 == 2\n }\n}\n',
|
||||
'haml':
|
||||
'!!! XML\n%html\n %body\n %h1.jumbo{:id=>"a", :style=>\'font-weight: normal\', :title=>title} highlight.js\n /html comment\n -# ignore this line\n %ul(style=\'margin: 0\')\n -items.each do |i|\n %i= i\n = variable\n =variable2\n ~ variable3\n ~variable4\n The current year is #{DataTime.now.year}.\n',
|
||||
'handlebars':
|
||||
'<div class="entry">\n {{!-- only show if author exists --}}\n {{#if author}}\n <h1>{{firstName}} {{lastName}}</h1>\n {{/if}}\n</div>\n',
|
||||
'haskell':
|
||||
'{-# LANGUAGE TypeSynonymInstances #-}\nmodule Network.UDP\n( DataPacket(..)\n, openBoundUDPPort\n, openListeningUDPPort\n, pingUDPPort\n, sendUDPPacketTo\n, recvUDPPacket\n, recvUDPPacketFrom\n) where\n\nimport qualified Data.ByteString as Strict (ByteString, concat, singleton)\nimport qualified Data.ByteString.Lazy as Lazy (ByteString, toChunks, fromChunks)\nimport Data.ByteString.Char8 (pack, unpack)\nimport Network.Socket hiding (sendTo, recv, recvFrom)\nimport Network.Socket.ByteString (sendTo, recv, recvFrom)\n\n-- Type class for converting StringLike types to and from strict ByteStrings\nclass DataPacket a where\n toStrictBS :: a -> Strict.ByteString\n fromStrictBS :: Strict.ByteString -> a\n\ninstance DataPacket Strict.ByteString where\n toStrictBS = id\n {-# INLINE toStrictBS #-}\n fromStrictBS = id\n {-# INLINE fromStrictBS #-}\n\nopenBoundUDPPort :: String -> Int -> IO Socket\nopenBoundUDPPort uri port = do\n s <- getUDPSocket\n bindAddr <- inet_addr uri\n let a = SockAddrInet (toEnum port) bindAddr\n bindSocket s a\n return s\n\npingUDPPort :: Socket -> SockAddr -> IO ()\npingUDPPort s a = sendTo s (Strict.singleton 0) a >> return ()\n',
|
||||
'haxe':
|
||||
'package my.package;\n\n#if js\nimport js.Browser;\n#elseif sys\nimport Sys;\n#else\nimport Date;\n#end\n\nimport Lambda;\nusing Main.IntExtender;\n\nextern class Math {\n static var PI(default,null) : Float;\n static function floor(v:Float):Int;\n}\n\n/**\n * Abstract forwarding\n */\nabstract MyAbstract(Int) from Int to Int {\n inline function new(i:Int) {\n this = i;\n }\n\n @:op(A * B)\n public function multiply(rhs:MyAbstract) {\n return this * rhs;\n }\n}\n\n// an enum\nenum Color {\n Red;\n Green;\n Blue;\n Rgb(r:Int, g:Int, b:Int);\n}\n\n@:generic\nclass Gen<T> {\n var v:T;\n public function new(v:T) {\n this.v = v;\n }\n\n public var x(get, set):T;\n\n private inline function get_x():T\n return v;\n\n private inline function set_x(x:T):T\n return v = x;\n}\n\nclass Main extends BaseClass implements SomeFunctionality {\n var callback:Void->Void = null;\n var myArray:Array<Float> = new Array<Float>();\n var arr = [4,8,0,3,9,1,5,2,6,7];\n\n public function new(x) {\n super(x);\n }\n\n public static function main() {\n trace(\'What\\\'s up?\');\n trace(\'Hi, \${name}!\');\n\n // switch statements!\n var c:Color = Color.Green;\n var x:Int = switch(c) {\n case Red: 0;\n case Green: 1;\n case Blue: 2;\n case Rgb(r, g, b): 3;\n case _: -1;\n }\n\n for(i in 0...3) {\n trace(i);\n continue;\n break;\n }\n\n do {\n trace("Hey-o!");\n } while(false);\n\n var done:Bool = false;\n while(!done) {\n done = true;\n }\n\n var H:Int = cast new MyAbstract(42);\n var h:Int = cast(new MyAbstract(31), Int);\n\n try {\n throw "error";\n }\n catch(err:String) {\n trace(err);\n }\n \n var map = new haxe.ds.IntMap<String>();\n var f = map.set.bind(_, "12");\n }\n\n function nothing():Void\n trace("nothing!");\n\n private inline function func(a:Int, b:Float, ?c:String, d:Bool=false):Dynamic {\n return {\n x: 0,\n y: true,\n z: false,\n a: 1.53,\n b: 5e10,\n c: -12,\n h: null\n };\n }\n\n\n override function quicksort( lo : Int, hi : Int ) : Void {\n var i = lo;\n var j = hi;\n var buf = arr;\n var p = buf[(lo+hi)>>1];\n while( i <= j ) {\n while( arr[i] > p ) i++;\n while( arr[j] < p ) j--;\n if( i <= j ) {\n var t = buf[i];\n buf[i++] = buf[j];\n buf[j--] = t;\n }\n }\n if( lo < j ) quicksort( lo, j );\n if( i < hi ) quicksort( i, hi );\n }\n}',
|
||||
'hsp':
|
||||
'#include "foo.hsp"\n\n // line comment\n message = "Hello, World!"\n message2 = {"Multi\n line\n string"}\n num = 0\n mes message\n \n input num : button "sqrt", *label\n stop\n \n*label\n /*\n block comment\n */\n if(num >= 0) {\n dialog "sqrt(" + num + ") = " + sqrt(num)\n } else {\n dialog "error", 1\n }\n stop\n',
|
||||
'htmlbars':
|
||||
'<div class="entry">\n {{!-- only output this author names if an author exists --}}\n {{#if author}}\n {{#playwright-wrapper playwright=author action=(mut author) as |playwright|}}\n <h1>{{playwright.firstName}} {{playwright.lastName}}</h1>\n {{/playwright-wrapper}}\n {{/if}}\n {{yield}}\n</div>\n',
|
||||
'http':
|
||||
'POST /task?id=1 HTTP/1.1\nHost: example.org\nContent-Type: application/json; charset=utf-8\nContent-Length: 137\n\n{\n "status": "ok",\n "extended": true,\n "results": [\n {"value": 0, "type": "int64"},\n {"value": 1.0e+3, "type": "decimal"}\n ]\n}\n',
|
||||
'hy':
|
||||
'#!/usr/bin/env hy\n\n(import os.path)\n\n(import hy.compiler)\n(import hy.core)\n\n\n;; absolute path for Hy core\n(setv *core-path* (os.path.dirname hy.core.--file--))\n\n\n(defn collect-macros [collected-names opened-file]\n (while True\n (try\n (let [data (read opened-file)]\n (if (and (in (first data)\n \'(defmacro defmacro/g! defn))\n (not (.startswith (second data) "_")))\n (.add collected-names (second data))))\n (except [e EOFError] (break)))))\n\n\n(defmacro core-file [filename]\n `(open (os.path.join *core-path* ~filename)))\n\n\n(defmacro contrib-file [filename]\n `(open (os.path.join *core-path* ".." "contrib" ~filename)))\n\n\n(defn collect-core-names []\n (doto (set)\n (.update hy.core.language.*exports*)\n (.update hy.core.shadow.*exports*)\n (collect-macros (core-file "macros.hy"))\n (collect-macros (core-file "bootstrap.hy"))))\n',
|
||||
'inform7':
|
||||
'Book 1 - Language Definition Testing File\n\n[Comments in Inform 7 can be [nested] inside one another]\n\nSyntax highlighting is an action applying to one thing.\nUnderstand "highlight [something preferably codeish]" as syntax highlighting.\n\nCode is a kind of thing. Code is usually plural-named.\n\nCode can be highlighted. Code is usually not highlighted.\n\nCheck syntax highlighting:\n unless the noun is code:\n say "[The noun] isn\'t source code you can highlight.";\n rule fails.\n\nCarry out syntax highlighting:\n now the noun is highlighted.\n\nTable of Programming Languages\nlanguage utility\nruby "Web back-end development"\nlua "Embedded scripting"\nerlang "High-concurrency server applications"',
|
||||
'ini':
|
||||
'; boilerplate\n[package]\nname = "some_name"\nauthors = ["Author"]\ndescription = "This is \\\na description"\n\n[[lib]]\nname = \${NAME}\ndefault = True\nauto = no\ncounter = 1_000\n',
|
||||
'irpf90':
|
||||
' BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted_bit, (N_int,2,psi_det_size) ]\n&BEGIN_PROVIDER [ double precision, psi_coef_sorted_bit, (psi_det_size,N_states) ]\n implicit none\n BEGIN_DOC\n ! Determinants on which we apply <i|H|psi> for perturbation.\n ! They are sorted by determinants interpreted as integers. Useful\n ! to accelerate the search of a random determinant in the wave\n ! function.\n END_DOC\n integer :: i,j,k\n integer, allocatable :: iorder(:)\n integer*8, allocatable :: bit_tmp(:)\n integer*8, external :: det_search_key\n\n allocate ( iorder(N_det), bit_tmp(N_det) )\n\n do i=1,N_det\n iorder(i) = i\n !DIR\$ FORCEINLINE\n bit_tmp(i) = det_search_key(psi_det(1,1,i),N_int)\n enddo\n call isort(bit_tmp,iorder,N_det)\n !DIR\$ IVDEP\n do i=1,N_det\n do j=1,N_int\n psi_det_sorted_bit(j,1,i) = psi_det(j,1,iorder(i))\n psi_det_sorted_bit(j,2,i) = psi_det(j,2,iorder(i))\n enddo\n do k=1,N_states\n psi_coef_sorted_bit(i,k) = psi_coef(iorder(i),k)\n enddo\n enddo\n\n deallocate(iorder, bit_tmp)\n\nEND_PROVIDER\n\n',
|
||||
'isbl':
|
||||
' // Описание констант\n ADD_EQUAL_NUMBER_TEMPLATE = "%s.%s = %s"\n EMPLOYEES_REFERENCE = "РАБ"\n /********************************************* \n * Получить список кодов или ИД работников, *\n * соответствующих текущему пользователю *\n *********************************************/\n Employees: IReference.РАБ = CreateReference(EMPLOYEES_REFERENCE; \n ArrayOf("Пользователь"; SYSREQ_STATE); MyFunction(FALSE; MyParam * 0.05))\n Employees.Events.DisableAll\n EmployeesTableName = Employees.TableName\n EmployeesUserWhereID = Employees.AddWhere(Format(ADD_EQUAL_NUMBER_TEMPLATE; \n ArrayOf(EmployeesTableName; Employees.Requisites("Пользователь").SQLFieldName; \n EDocuments.CurrentUser.ID)))\n Employees.Open()\n Result = CreateStringList()\n foreach Employee in Employees\n if IsResultCode\n Result.Add(Employee.SYSREQ_CODE)\n else\n Result.Add(Employee.SYSREQ_ID)\n endif \n endforeach\n Employees.Close()\n Employees.DelWhere(EmployeesUserWhereID)\n Employees.Events.EnableAll\n Employees = nil',
|
||||
'java':
|
||||
'/**\n * @author John Smith <john.smith@example.com>\n*/\npackage l2f.gameserver.model;\n\npublic abstract class L2Char extends L2Object {\n public static final Short ERROR = 0x0001;\n\n public void moveTo(int x, int y, int z) {\n _ai = null;\n log("Should not be called");\n if (1 > 5) { // wtf!?\n return;\n }\n }\n}\n',
|
||||
'javascript':
|
||||
'function \$initHighlight(block, cls) {\n try {\n if (cls.search(/\\bno\\-highlight\\b/) != -1)\n return process(block, true, 0x0F) +\n ` class="\${cls}"`;\n } catch (e) {\n /* handle exception */\n }\n for (var i = 0 / 2; i < classes.length; i++) {\n if (checkCondition(classes[i]) === undefined)\n console.log(\'undefined\');\n }\n\n return (\n <div>\n <web-component>{block}</web-component>\n </div>\n )\n}\n\nexport \$initHighlight;\n',
|
||||
'jboss-cli':
|
||||
'jms-queue add --queue-address=myQueue --entries=queue/myQueue\n\ndeploy /path/to/file.war\n\n/system-property=prop1:add(value=value1)\n\n\n\n/extension=org.jboss.as.modcluster:add\n\n./foo=bar:remove\n\n/subsystem=security/security-domain=demo-realm/authentication=classic:add\n\n/subsystem=security/security-domain=demo-realm/authentication=classic/login-module=UsersRoles:add( \\\n code=UsersRoles, \\\n flag=required, \\\n module-options= { \\\n usersProperties=auth/demo-users.properties, \\\n rolesProperties =auth/demo-roles.properties, \\\n hashAlgorithm= MD5, \\\n hashCharset="UTF-8" \\\n } \\\n)\n',
|
||||
'json':
|
||||
'[\n {\n "title": "apples",\n "count": [12000, 20000],\n "description": {"text": "...", "sensitive": false}\n },\n {\n "title": "oranges",\n "count": [17500, null],\n "description": {"text": "...", "sensitive": false}\n }\n]\n',
|
||||
'julia':
|
||||
'### Types\n\n# Old-style definitions\n\nimmutable Point{T<:AbstractFloat}\n index::Int\n x::T\n y::T\nend\n\nabstract A\n\ntype B <: A end\n\ntypealias P Point{Float16}\n\n# New-style definitions\n\nstruct Plus\n f::typeof(+)\nend\n\nmutable struct Mut\n mutable::A # mutable should not be highlighted (not followed by struct)\n primitive::B # primitive should not be highlighted (not followed by type)\nend\n\nprimitive type Prim 8 end\n\nabstract type Abstr end\n\n### Modules\n\nmodule M\n\nusing X\nimport Y\nimportall Z\n\nexport a, b, c\n\nend # module\n\nbaremodule Bare\nend\n\n### New in 0.6\n\n# where, infix isa, UnionAll\nfunction F{T}(x::T) where T\n for i in x\n i isa UnionAll && return\n end\nend\n\n### Miscellaneous\n\n#=\nMulti\nLine\nComment\n=#\nfunction method0(x, y::Int; version::VersionNumber=v"0.1.2")\n """\n Triple\n Quoted\n String\n """\n\n @assert π > e\n\n s = 1.2\n 変数 = "variable"\n\n if s * 100_000 ≥ 5.2e+10 && true || x === nothing\n s = 1. + .5im\n elseif 1 ∈ [1, 2, 3]\n println("s is \$s and 変数 is \$変数")\n else\n x = [1 2 3; 4 5 6]\n @show x\'\n end\n\n local var = rand(10)\n global g = 44\n var[1:5]\n var[5:end-1]\n var[end]\n\n opt = "-la"\n run(`ls \$opt`)\n\n try\n ccall(:lib, (Ptr{Void},), Ref{C_NULL})\n catch\n throw(ArgumentError("wat"))\n finally\n warn("god save the queen")\n end\n\n \'\\u2200\' != \'T\'\n\n return 5s / 2\nend\n',
|
||||
'julia-repl':
|
||||
'julia> function foo(x) x + 1 end\nfoo (generic function with 1 method)\n\njulia> foo(42)\n43\n\njulia> foo(42) === 43.\nfalse\n\n\nHere we match all three lines of code:\n\njulia> function foo(x::Float64)\n 42. - x\n end\nfoo (generic function with 2 methods)\n\njulia> for x in Any[1, 2, 3.4]\n println("foo(\$x) = \$(foo(x))")\n end\nfoo(1) = 2\nfoo(2) = 3\nfoo(3.4) = 38.6\n\n\n... unless it is not properly indented:\n\njulia> function foo(x)\n x + 1\nend\n\n\nOrdinary Julia code does not get highlighted:\n\nPkg.add("Combinatorics")\nabstract type Foo end\n',
|
||||
'kotlin':
|
||||
'import kotlin.lang.test\n\ntrait A {\n fun x()\n}\n\nfun xxx() : Int {\n return 888\n}\n\npublic fun main(args : Array<String>) {\n}\n',
|
||||
'lasso':
|
||||
'<?LassoScript\n/* Lasso 8 */\n local(\'query\' = \'SELECT * FROM `\'+var:\'table\'+\'` WHERE `id` > 10\n ORDER BY `Name` LIMIT 30\');\n Inline: -Username=\$DBuser, -Password=\$DBpass, -Database=\$DBname, -sql=#query;\n var("class1.name" = (found_count != 0 ? "subtotal" | "nonefound"),\n "total_amount" = found_count || "No results");\n records;\n output: "<tr>"loop_count"</tr>";\n /records;\n /Inline;\n?><div class="[\$class1.name]">[\$total_amount]</div>\n<?lasso\n/* Lasso 9 */ ?>\n[noprocess] causes [delimiters] to be <?=skipped?> until the next [/noprocess]\n[\n define strings.combine(value::string, ...other)::string => {\n local(result = #value->append(#other->asString&trim))\n return set(#result, not #other, \\givenBlock)\n }\n /**! descriptive text */\n define person => type {\n parent entity\n data name::string, protected nickname, birthdate :: date\n data private ssn = null\n private showAge() => frozen { return ..age }\n protected fullName() => `"` + .nickname + `"` + .\'name\'\n public ssnListed::boolean => .ssn() ? true | false\n }\n define person->name=(value) => {\n .\'name\' = #value\n return self->\'name\'\n }\n define bytes->+(rhs::bytes) => bytes(self)->append(#rhs)&\n] <!-- an HTML comment <?=disables delimiters?> as well -->\n[no_square_brackets] disables [square brackets] for the rest of the file\n<?=\n // query expression\n with n in array((:-12, 0xABCD, 3.14159e14), (:NaN, -infinity, .57721))\n let swapped = pair(#n->\\second, #n->first)\n group #swapped by #n->first into t\n let key = #t->key\n order by #key\n select pair(#key, #1)\n do {^\n #n->upperCase\n ^}\n?>\n',
|
||||
'ldif':
|
||||
'# Example LDAP user\ndn: uid=user.0,ou=People,dc=example,dc=com\nobjectClass: top\nobjectClass: person\nobjectClass: organizationalPerson\nobjectClass: inetOrgPerson\ngivenName: Morris\nsn: Day\ncn: Morris Day\ninitials: MD\nemployeeNumber: 0\nuid: user.0\nmail: user.0@example.com\nuserPassword: password\ntelephoneNumber: +1 042 100 3866\nhomePhone: +1 039 680 4135\npager: +1 284 199 0966\nmobile: +1 793 707 0251\nstreet: 90280 Spruce Street\nl: Minneapolis\nst: MN\npostalCode: 50401\npostalAddress: Morris Day\$90280 Spruce Street\$Minneapolis, MN 50401\ndescription: This is the description for Morris Day.\n\ndn: CN=John Smith,OU=Legal,DC=example,DC=com\nchangetype: modify\nreplace: employeeID\nemployeeID: 1234\n-\nreplace: employeeNumber\nemployeeNumber: 98722\n-\nreplace: extensionAttribute6\nextensionAttribute6: JSmith98\n-\n\ndn: CN=Jane Smith,OU=Accounting,DC=example,DC=com\nchangetype: modify\nreplace: employeeID\nemployeeID: 5678\n-\nreplace: employeeNumber\nemployeeNumber: 76543\n-\nreplace: extensionAttribute6\nextensionAttribute6: JSmith14\n-\n',
|
||||
'leaf':
|
||||
'#empty(friends) {\n Try adding some friends!\n} ##loop(friends, "friend") {\n <li> #(friend.name) </li>\n}\n\n#someTag(parameter.list, goes, "here") {\n This is an optional body here\n}\n\n#index(friends, "0") {\n Hello, #(self)!\n} ##else() {\n Nobody\'s there!\n}\n\n#()\n\n#raw() {\n <li> Hello </li>\n}\n',
|
||||
'less':
|
||||
'@import "fruits";\n\n@rhythm: 1.5em;\n\n@media screen and (min-resolution: 2dppx) {\n body {font-size: 125%}\n}\n\nsection > .foo + #bar:hover [href*="less"] {\n margin: @rhythm 0 0 @rhythm;\n padding: calc(5% + 20px);\n background: #f00ba7 url(http://placehold.alpha-centauri/42.png) no-repeat;\n background-image: linear-gradient(-135deg, wheat, fuchsia) !important ;\n background-blend-mode: multiply;\n}\n\n@font-face {\n font-family: /* ? */ \'Omega\';\n src: url(\'../fonts/omega-webfont.woff?v=2.0.2\');\n}\n\n.icon-baz::before {\n display: inline-block;\n font-family: "Omega", Alpha, sans-serif;\n content: "\\f085";\n color: rgba(98, 76 /* or 54 */, 231, .75);\n}\n',
|
||||
'lisp':
|
||||
'#!/usr/bin/env csi\n\n(defun prompt-for-cd ()\n "Prompts\n for CD"\n (prompt-read "Title" 1.53 1 2/4 1.7 1.7e0 2.9E-4 +42 -7 #b001 #b001/100 #o777 #O777 #xabc55 #c(0 -5.6))\n (prompt-read "Artist" &rest)\n (or (parse-integer (prompt-read "Rating") :junk-allowed t) 0)\n (if x (format t "yes") (format t "no" nil) ;and here comment\n )\n ;; second line comment\n \'(+ 1 2)\n (defvar *lines*) ; list of all lines\n (position-if-not #\'sys::whitespacep line :start beg))\n (quote (privet 1 2 3))\n \'(hello world)\n (* 5 7)\n (1 2 34 5)\n (:use "aaaa")\n (let ((x 10) (y 20))\n (print (+ x y))\n )',
|
||||
'livecodeserver':
|
||||
'<?rev\n\nglobal gControllerHandlers, gData\nlocal sTest\nput "blog,index" into gControllerHandlers\n\n\ncommand blog\n -- simple comment\n put "Hello World!" into sTest\n # ANOTHER COMMENT\n put "form,url,asset" into tHelpers\n rigLoadHelper tHelpers\nend blog\n\n/*Hello\nblock comment!*/\n\nfunction myFunction\n if the secs > 2000000000 then\n put "Welcome to the future!"\n else\n return "something"\n end if\nend myFunction\n\n\n--| END OF blog.lc\n--| Location: ./system/application/controllers/blog.lc\n----------------------------------------------------------------------\n',
|
||||
'livescript':
|
||||
'# take the first n objects from a list\ntake = (n, [x, ...xs]:list) -->\n | n <= 0 => []\n | empty list => []\n | otherwise => [x] ++ take n - 1, xs\n\ntake 2, [1, 2, 3, 4, 5]\n\n# Curried functions\ntake-three = take 3\ntake-three [6, 7, 8, 9, 10]\n\n# Function composition\nlast-three = reverse >> take-three >> reverse\nlast-three [1 to 8]\n\n# List comprehensions and piping\nconst t1 =\n * id: 1\n name: \'george\'\n * id: 2\n name: \'mike\'\n * id: 3\n name: \'donald\'\n\nconst t2 =\n * id: 2\n age: 21\n * id: 1\n age: 20\n * id: 3\n age: 26\n[{id:id1, name, age}\n for {id:id1, name} in t1\n for {id:id2, age} in t2\n where id1 is id2]\n |> sort-by \\id\n |> JSON.stringify\n\n~function add x, y\n @result = x + y\n\nclass A\n (num) ->\n @x = num\n property: 1\n method: (y) ->\n @x + @property + y\n\na = new A 3\na.x #=> 3\na.property #=> 1\na.method 6 #=> 10\n\nf = !-> 2\ng = (x) !-> x + 2\n\nresult = switch \'test\'\ncase \'blatant\'\n \'effort\'\n fallthrough\ncase \'at\'\n \'increasing\'\n fallthrough\ncase \'relevance\'\n void\n',
|
||||
'llvm':
|
||||
'; ModuleID = \'test.c\'\ntarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"\ntarget triple = "x86_64-unknown-linux-gnu"\n\n%struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] }\n%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }\n%struct.what = type { i8, i16 }\n\n@.str = private unnamed_addr constant [6 x i8] c"foo()\\00", align 1\n@e_long = common global i64 0, align 8\n@g_double = common global double 0.000000e+00, align 8\n@.str.1 = private unnamed_addr constant [7 x i8] c"oooooh\\00", align 1\n@func_ptr = common global i32 (...)* null, align 8\n@stderr = external global %struct._IO_FILE*, align 8\n\n; Function Attrs: nounwind uwtable\ndefine i32 @foo() #0 {\n %1 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0))\n ret i32 0\n}\n\ndeclare i32 @puts(i8*) #1\n\n; Function Attrs: nounwind uwtable\ndefine i32 @main(i32 %argc, i8** %argv) #0 {\n %1 = alloca i32, align 4\n %2 = alloca i32, align 4\n %3 = alloca i8**, align 8\n\n; <label>:7 ; preds = %0\n %8 = getelementptr inbounds %struct.what, %struct.what* %X, i32 0, i32 0\n store i8 1, i8* %8, align 2\n store i8 49, i8* %b_char, align 1\n %9 = getelementptr inbounds %struct.what, %struct.what* %X, i32 0, i32 1\n store double 1.000000e+01, double* @g_double, align 8\n store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8** %cp_char_ptr, align 8\n store i32 (...)* bitcast (i32 ()* @foo to i32 (...)*), i32 (...)** @func_ptr, align 8\n %10 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0))\n store i32 10, i32* %1, align 4\n br label %66\n\n; <label>:63 ; preds = %11\n %64 = load %struct._IO_FILE*, %struct._IO_FILE** @stderr, align 8\n %65 = call i32 @fputs(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i32 0, i32 0), %struct._IO_FILE* %64)\n store i32 -1, i32* %1, align 4\n br label %66\n\n; <label>:66 ; preds = %63, %46, %7\n %67 = load i32, i32* %1, align 4\n ret i32 %67\n}\n\ndeclare i32 @printf(i8*, ...) #1\n\ndeclare i32 @fputs(i8*, %struct._IO_FILE*) #1\n\nattributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }\n\n!llvm.ident = !{!0}\n\n!0 = !{!"clang version 3.8.0 (tags/RELEASE_380/final)"}\n',
|
||||
'lsl':
|
||||
'default\n{\n state_entry()\n {\n llSay(PUBLIC_CHANNEL, "Hello, Avatar!");\n }\n\n touch_start(integer num_detected)\n {\n llSay(PUBLIC_CHANNEL, "Touched.");\n }\n}\n',
|
||||
'lua':
|
||||
'--[[\nSimple signal/slot implementation\n]]\nlocal signal_mt = {\n __index = {\n register = table.insert\n }\n}\nfunction signal_mt.__index:emit(... --[[ Comment in params ]])\n for _, slot in ipairs(self) do\n slot(self, ...)\n end\nend\nlocal function create_signal()\n return setmetatable({}, signal_mt)\nend\n\n-- Signal test\nlocal signal = create_signal()\nsignal:register(function(signal, ...)\n print(...)\nend)\nsignal:emit(\'Answer to Life, the Universe, and Everything:\', 42)\n\n--[==[ [=[ [[\nNested ]]\nmulti-line ]=]\ncomment ]==]\n[==[ Nested\n[=[ multi-line\n[[ string\n]] ]=] ]==]\n',
|
||||
'makefile':
|
||||
'# Makefile\n\nBUILDDIR = _build\nEXTRAS ?= \$(BUILDDIR)/extras\n\n.PHONY: main clean\n\nmain:\n @echo "Building main facility..."\n build_main \$(BUILDDIR)\n\nclean:\n rm -rf \$(BUILDDIR)/*\n',
|
||||
'markdown':
|
||||
'# hello world\n\nyou can write text [with links](http://example.com) inline or [link references][1].\n\n* one _thing_ has *em*phasis\n* two __things__ are **bold**\n\n[1]: http://example.com\n\n---\n\nhello world\n===========\n\n<this_is inline="xml"></this_is>\n\n> markdown is so cool\n\n so are code segments\n\n1. one thing (yeah!)\n2. two thing `i can write code`, and `more` wipee!\n\n',
|
||||
'mathematica':
|
||||
'(* ::Package:: *)\n\n(* Mathematica Package *)\n\nBeginPackage["SomePkg`"]\n\nBegin["`Private`"]\n\nSomeFn[ns_List] := Fold[Function[{x, y}, x + y], 0, Map[# * 2 &, ns]];\nPrint[\$ActivationKey];\n\nEnd[] (* End Private Context *)\n\nEndPackage[]\n',
|
||||
'matlab':
|
||||
'n = 20; % number of points\npoints = [random(\'unid\', 100, n, 1), random(\'unid\', 100, n, 1)];\nlen = zeros(1, n - 1);\npoints = sortrows(points);\n%% Initial set of points\nplot(points(:,1),points(:,2));\nfor i = 1: n-1\n len(i) = points(i + 1, 1) - points(i, 1);\nend\nwhile(max(len) > 2 * min(len))\n [d, i] = max(len);\n k = on_margin(points, i, d, -1);\n m = on_margin(points, i + 1, d, 1);\n xm = 0; ym = 0;\n%% New point\n if(i == 1 || i + 1 == n)\n xm = mean(points([i,i+1],1))\n ym = mean(points([i,i+1],2))\n else\n [xm, ym] = dlg1(points([k, i, i + 1, m], 1), ...\n points([k, i, i + 1, m], 2))\n end\n\n points = [ points(1:i, :); [xm, ym]; points(i + 1:end, :)];\nend\n\n%{\n This is a block comment. Please ignore me.\n%}\n\nfunction [net] = get_fit_network(inputs, targets)\n % Create Network\n numHiddenNeurons = 20; % Adjust as desired\n net = newfit(inputs,targets,numHiddenNeurons);\n net.trainParam.goal = 0.01;\n net.trainParam.epochs = 1000;\n % Train and Apply Network\n [net,tr] = train(net,inputs,targets);\nend\n\nfoo_matrix = [1, 2, 3; 4, 5, 6]\'\'\';\nfoo_cell = {1, 2, 3; 4, 5, 6}\'\'.\'.\';\n\ncell2flatten = {1,2,3,4,5};\nflattenedcell = cat(1, cell2flatten{:});\n',
|
||||
'maxima':
|
||||
'/* Maxima computer algebra system */\n\n/* symbolic constants */\n\n[true, false, unknown, inf, minf, ind,\n und, %e, %i, %pi, %phi, %gamma];\n\n/* programming keywords */\n\nif a then b elseif c then d else f;\nfor x:1 thru 10 step 2 do print(x);\nfor z:-2 while z < 0 do print(z);\nfor m:0 unless m > 10 do print(m);\nfor x in [1, 2, 3] do print(x);\nfoo and bar or not baz;\n\n/* built-in variables */\n\n[_, __, %, %%, linel, simp, dispflag,\n stringdisp, lispdisp, %edispflag];\n\n/* built-in functions */\n\n[sin, cosh, exp, atan2, sqrt, log, struve_h,\n sublist_indices, read_array];\n\n/* user-defined symbols */\n\n[foo, ?bar, baz%, quux_mumble_blurf];\n\n/* symbols using Unicode characters */\n\n[Љ, Щ, щ, Ӄ, ЩЩЩ, ӃӃЉЉщ];\n\n/* numbers */\n\nibase : 18 \$\n[0, 1234, 1234., 0abcdefgh];\nreset (ibase) \$\n[.54321, 3.21e+0, 12.34B56];\n\n/* strings */\n\ns1 : "\\"now\\" is";\ns2 : "the \'time\' for all good men";\nprint (s1, s2, "to come to the aid",\n "of their country");\n\n/* expressions */\n\nfoo (x, y, z) :=\n if x > 1 + y\n then z - x*y\n elseif y <= 100!\n then x/(y + z)^2\n else z - y . x . y;\n\n',
|
||||
'mel':
|
||||
'proc string[] getSelectedLights()\n\n{\n string \$selectedLights[];\n\n string \$select[] = `ls -sl -dag -leaf`;\n\n for ( \$shape in \$select )\n {\n // Determine if this is a light.\n //\n string \$class[] = getClassification( `nodeType \$shape` );\n\n\n if ( ( `size \$class` ) > 0 && ( "light" == \$class[0] ) )\n {\n \$selectedLights[ `size \$selectedLights` ] = \$shape;\n }\n }\n\n // Result is an array of all lights included in\n\n // current selection list.\n return \$selectedLights;\n}\n',
|
||||
'mercury':
|
||||
'% "Hello World" in Mercury.\n:- module hello.\n\n\n:- interface.\n:- import_module io.\n\n:- pred main(io::di, io::uo) is det.\n\n\n:- implementation.\n\nmain(!IO) :-\n io.write_string("Hello, world\\n", !IO).\n\n:- pred filter(pred(T), list(T), list(T), list(T) ).\n:- mode filter(in(pred(in) is semidet), in, out, out ) is det.\n\nfilter(_, [], [], []).\nfilter(P, [X | Xs], Ys, Zs) :-\n filter(P, Xs, Ys0, Zs0),\n ( if P(X) then Ys = [X | Ys0], Zs = Zs0\n else Ys = Ys0 , Zs = [X | Zs0]\n ).\n',
|
||||
'mipsasm':
|
||||
'.text\n.global AckermannFunc\n\n# Preconditions:\n# 1st parameter (\$a0) m\n# 2nd parameter (\$a1) n\n# Postconditions:\n# result in (\$v0) = value of A(m,n)\n\nAckermannFunc:\n addi \$sp, \$sp, -8\n sw \$s0, 4(\$sp)\n sw \$ra, 0(\$sp)\n\n # move the parameter registers to temporary - no, only when nec.\n\nLABEL_IF: bne \$a0, \$zero, LABEL_ELSE_IF\n\n addi \$v0, \$a1, 1\n\n # jump to LABEL_DONE\n j LABEL_DONE\n',
|
||||
'mizar':
|
||||
'::: ## Lambda calculus\n\nenviron\n\n vocabularies LAMBDA,\n NUMBERS,\n NAT_1, XBOOLE_0, SUBSET_1, FINSEQ_1, XXREAL_0, CARD_1,\n ARYTM_1, ARYTM_3, TARSKI, RELAT_1, ORDINAL4, FUNCOP_1;\n\n :: etc...\n\nbegin\n\nreserve D for DecoratedTree,\n p,q,r for FinSequence of NAT,\n x for set;\n\ndefinition\n let D;\n\n attr D is LambdaTerm-like means\n (dom D qua Tree) is finite &\n::> *143,306\n for r st r in dom D holds\n r is FinSequence of {0,1} &\n r^<*0*> in dom D implies D.r = 0;\nend;\n\nregistration\n cluster LambdaTerm-like for DecoratedTree of NAT;\n existence;\n::> *4\nend;\n\ndefinition\n mode LambdaTerm is LambdaTerm-like DecoratedTree of NAT;\nend;\n\n::: Then we extend this ordinary one-step beta reduction, that is,\n::: any subterm is also allowed to reduce.\ndefinition\n let M,N;\n\n pred M beta N means\n ex p st\n M|p beta_shallow N|p &\n for q st not p is_a_prefix_of q holds\n [r,x] in M iff [r,x] in N;\nend;\n\ntheorem Th4:\n ProperPrefixes (v^<*x*>) = ProperPrefixes v \\/ {v}\nproof\n thus ProperPrefixes (v^<*x*>) c= ProperPrefixes v \\/ {v}\n proof\n let y;\n assume y in ProperPrefixes (v^<*x*>);\n then consider v1 such that\nA1: y = v1 and\nA2: v1 is_a_proper_prefix_of v^<*x*> by TREES_1:def 2;\n v1 is_a_prefix_of v & v1 <> v or v1 = v by A2,TREES_1:9;\nthen\n v1 is_a_proper_prefix_of v or v1 in {v} by TARSKI:def 1,XBOOLE_0:def 8;\nthen y in ProperPrefixes v or y in {v} by A1,TREES_1:def 2;\n hence thesis by XBOOLE_0:def 3;\n end;\n let y;\n assume y in ProperPrefixes v \\/ {v};\nthen A3: y in ProperPrefixes v or y in {v} by XBOOLE_0:def 3;\nA4: now\n assume y in ProperPrefixes v;\n then consider v1 such that\nA5: y = v1 and\nA6: v1 is_a_proper_prefix_of v by TREES_1:def 2;\n v is_a_prefix_of v^<*x*> by TREES_1:1;\nthen v1 is_a_proper_prefix_of v^<*x*> by A6,XBOOLE_1:58;\n hence thesis by A5,TREES_1:def 2;\n end;\n v^{} = v by FINSEQ_1:34;\n then\n v is_a_prefix_of v^<*x*> & v <> v^<*x*> by FINSEQ_1:33,TREES_1:1;\nthen v is_a_proper_prefix_of v^<*x*> by XBOOLE_0:def 8;\nthen y in ProperPrefixes v or y = v & v in ProperPrefixes (v^<*x*>)\n by A3,TARSKI:def 1,TREES_1:def 2;\n hence thesis by A4;\nend;',
|
||||
'mojolicious':
|
||||
'%layout \'bootstrap\';\n% title "Import your subs";\n%= form_for \'/settings/import\' => (method => \'post\', enctype => \'multipart/form-data\') => begin\n %= file_field \'opmlfile\' => multiple => \'true\'\n %= submit_button \'Import\', \'class\' => \'btn\'\n% end\n<div>\n% if (\$subs) {\n<dl>\n% for my \$item (@\$subs) {\n% my (\$dir, \$align) = (\$item->{rtl}) ? (\'rtl\', \'right\') : (\'ltr\', \'left\');\n<dt align="<%= \$align %>"><a href="<%= \$item->{\'xmlUrl\'} %>"><i class="icon-rss"></i> rss</a>\n<a dir="<%= \$dir %>" href="<%= \$item->{htmlUrl} %>"><%== \$item->{title} %></a>\n</dt>\n<dd><b>Categories</b>\n%= join q{, }, sort @{ \$item->{categories} || [] };\n</dd>\n</dl>\n% }\n</div>\n',
|
||||
'monkey':
|
||||
'#IMAGE_FILES="*.png|*.jpg"\n#SOUND_FILES="*.wav|*.ogg"\n#MUSIC_FILES="*.wav|*.ogg"\n#BINARY_FILES="*.bin|*.dat"\n\nImport mojo\n\n\' The main class which expends Mojo\'s \'App\' class:\nClass GameApp Extends App\n Field player:Player\n\n Method OnCreate:Int()\n Local img:Image = LoadImage("player.png")\n Self.player = New Player()\n SetUpdateRate(60)\n\n Return 0\n End\n\n Method OnUpdate:Int()\n player.x += HALFPI\n\n If (player.x > 100) Then\n player.x = 0\n Endif\n\n Return 0\n End\n\n Method OnRender:Int()\n Cls(32, 64, 128)\n player.Draw()\n\n player = Null\n Return 0\n End\nEnd\n',
|
||||
'moonscript':
|
||||
'print "I am #{math.random! * 100}% sure."\n\nmy_function = (name="something", height=100) ->\n print "Hello I am", name\n print "My height is", height\n\nmy_function dance: "Tango", partner: "none"\n\nmy_func 5,4,3, -- multi-line arguments\n 8,9,10\n\ntable = {\n name: "Bill",\n age: 200,\n ["favorite food"]: "rice",\n :keyvalue,\n [1+7]: \'eight\'\n}\n\nclass Inventory\n new: =>\n @items = {}\n\n add_item: (name) =>\n if @items[name]\n @items[name] += 1\n else\n @items[name] = 1\n\ninv = Inventory!\ninv\\add_item "t-shirt"\ninv\\add_item "pants"\n\nimport\n assert_csrf\n require_login\n from require "helpers"\n',
|
||||
'n1ql':
|
||||
'SELECT *\nFROM `beer-sample`\nWHERE brewery_id IS NOT MISSING AND type="beer"\nLIMIT 1;\n\nUPSERT INTO product (KEY, VALUE) VALUES (\n "odwalla-juice1", {\n "productId": "odwalla-juice1",\n "unitPrice": 5.40,\n "type": "product",\n "color":"red"\n }\n) RETURNING *;\n\nINFER `beer-sample` WITH {\n "sample_size": 10000,\n "num_sample_values": 1,\n "similarity_metric": 0.0\n};\n',
|
||||
'nginx':
|
||||
'user www www;\nworker_processes 2;\npid /var/run/nginx.pid;\nerror_log /var/log/nginx.error_log debug | info | notice | warn | error | crit;\n\nevents {\n connections 2000;\n use kqueue | rtsig | epoll | /dev/poll | select | poll;\n}\n\nhttp {\n log_format main \'\$remote_addr - \$remote_user [\$time_local] \'\n \'"\$request" \$status \$bytes_sent \'\n \'"\$http_referer" "\$http_user_agent" \'\n \'"\$gzip_ratio"\';\n\n send_timeout 3m;\n client_header_buffer_size 1k;\n\n gzip on;\n gzip_min_length 1100;\n\n #lingering_time 30;\n\n server {\n server_name one.example.com www.one.example.com;\n access_log /var/log/nginx.access_log main;\n\n rewrite (.*) /index.php?page=\$1 break;\n\n location / {\n proxy_pass http://127.0.0.1/;\n proxy_redirect off;\n proxy_set_header Host \$host;\n proxy_set_header X-Real-IP \$remote_addr;\n charset koi8-r;\n }\n\n location /api/ {\n fastcgi_pass 127.0.0.1:9000;\n }\n\n location ~* \\.(jpg|jpeg|gif)\$ {\n root /spool/www;\n }\n }\n}\n',
|
||||
'nimrod':
|
||||
'import module1, module2, module3\nfrom module4 import nil\n\ntype\n TFoo = object ## Doc comment\n a: int32\n PFoo = ref TFoo\n\nproc do_stuff314(param_1: TFoo, par2am: var PFoo): PFoo {.exportc: "dostuff" .} =\n # Regular comment\n discard """\n dfag\nsdfg""\n"""\n result = nil\n\nmethod abc(a: TFoo) = discard 1u32 + 0xabcdefABCDEFi32 + 0o01234567i8 + 0b010\n\ndiscard rawstring"asdf""adfa"\nvar normalstring = "asdf"\nlet a: uint32 = 0xFFaF\'u32\n',
|
||||
'nix':
|
||||
'{ stdenv, foo, bar ? false, ... }:\n\n/*\n * foo\n */\n\nlet\n a = 1; # just a comment\n b = null;\n c = toString 10;\nin stdenv.mkDerivation rec {\n name = "foo-\${version}";\n version = "1.3";\n\n configureFlags = [ "--with-foo2" ] ++ stdenv.lib.optional bar "--with-foo=\${ with stdenv.lib; foo }"\n\n postInstall = \'\'\n \${ if true then "--\${test}" else false }\n \'\';\n\n meta = with stdenv.lib; {\n homepage = https://nixos.org;\n };\n}\n',
|
||||
'nsis':
|
||||
'/*\n NSIS Scheme\n for highlight.js\n*/\n\n; Includes\n!include MUI2.nsh\n\n; Defines\n!define x64 "true"\n\n; Settings\nName "installer_name"\nOutFile "installer_name.exe"\nRequestExecutionLevel user\nCRCCheck on\n\n!ifdef \${x64}\n InstallDir "\$PROGRAMFILES64\\installer_name"\n!else\n InstallDir "\$PROGRAMFILES\\installer_name"\n!endif\n\n; Pages\n!insertmacro MUI_PAGE_INSTFILES\n\n; Sections\nSection "section_name" section_index\n nsExec::ExecToLog "calc.exe"\nSectionEnd\n\n; Functions\nFunction .onInit\n DetailPrint "The install button reads \$(^InstallBtn)"\n DetailPrint \'Here comes a\$\\n\$\\rline-break!\'\n DetailPrint `Escape the dollar-sign: \$\$`\nFunctionEnd\n',
|
||||
'objectivec':
|
||||
'#import <UIKit/UIKit.h>\n#import "Dependency.h"\n\n@protocol WorldDataSource\n@optional\n- (NSString*)worldName;\n@required\n- (BOOL)allowsToLive;\n@end\n\n@property (nonatomic, readonly) NSString *title;\n- (IBAction) show;\n@end\n',
|
||||
'ocaml':
|
||||
'(* This is a\nmultiline, (* nested *) comment *)\ntype point = { x: float; y: float };;\nlet some_string = "this is a string";;\nlet rec length lst =\n match lst with\n [] -> 0\n | head :: tail -> 1 + length tail\n ;;\nexception Test;;\ntype expression =\n Const of float\n | Var of string\n | Sum of expression * expression (* e1 + e2 *)\n | Diff of expression * expression (* e1 - e2 *)\n | Prod of expression * expression (* e1 * e2 *)\n | Quot of expression * expression (* e1 / e2 *)\nclass point =\n object\n val mutable x = 0\n method get_x = x\n method private move d = x <- x + d\n end;;\n',
|
||||
'openscad':
|
||||
'use <write.scad>\ninclude <../common/base.scad>\n\n//draw a foobar\nmodule foobar(){\n translate([0,-10,0])\n difference(){\n cube([5,10.04,15]);\n sphere(r=10,\$fn=100);\n }\n}\n\nfoobar();\n#cube ([5,5,5]);\necho("done");',
|
||||
'oxygene':
|
||||
'namespace LinkedList;\n\ninterface\n\nuses\n System.Text;\n\ntype\n List<T> = public class\n where T is Object;\n private\n method AppendToString(aBuilder: StringBuilder);\n public\n constructor(aData: T);\n constructor(aData: T; aNext: List<T>);\n property Next: List<T>;\n property Data: T;\n\n method ToString: string; override;\n end;\n\nimplementation\n\nconstructor List<T>(aData: T);\nbegin\n Data := aData;\nend;\n\nconstructor List<T>(aData: T; aNext: List<T>);\nbegin\n constructor(aData);\n Next := aNext;\nend;\n\nmethod List<T>.ToString: string;\nbegin\n with lBuilder := new StringBuilder do begin\n AppendToString(lBuilder);\n result := lBuilder.ToString();\n end;\nend;\n\nmethod List<T>.AppendToString(aBuilder: StringBuilder);\nbegin\n if assigned(Data) then\n aBuilder.Append(Data.ToString)\n else\n aBuilder.Append(\'nil\');\n\n if assigned(Next) then begin\n aBuilder.Append(\', \');\n Next.AppendToString(aBuilder);\n end;\nend;\n\nend.\n',
|
||||
'parser3':
|
||||
'@CLASS\nbase\n\n@USE\nmodule.p\n\n@BASE\nclass\n\n# Comment for code\n@create[aParam1;aParam2][local1;local2]\n ^connect[mysql://host/database?ClientCharset=windows-1251]\n ^for[i](1;10){\n <p class="paragraph">^eval(\$i+10)</p>\n ^connect[mysql://host/database]{\n \$tab[^table::sql{select * from `table` where a=\'1\'}]\n \$var_Name[some\${value}]\n }\n }\n\n ^rem{\n Multiline comment with code: \$var\n ^while(true){\n ^for[i](1;10){\n ^sleep[]\n }\n }\n }\n ^taint[^#0A]\n\n@GET_base[]\n## Comment for code\n # Isn\'t comment\n \$result[\$.hash_item1[one] \$.hash_item2[two]]\n',
|
||||
'perl':
|
||||
'# loads object\nsub load\n{\n my \$flds = \$c->db_load(\$id,@_) || do {\n Carp::carp "Can`t load (class: \$c, id: \$id): \'\$!\'"; return undef\n };\n my \$o = \$c->_perl_new();\n \$id12 = \$id / 24 / 3600;\n \$o->{\'ID\'} = \$id12 + 123;\n #\$o->{\'SHCUT\'} = \$flds->{\'SHCUT\'};\n my \$p = \$o->props;\n my \$vt;\n \$string =~ m/^sought_text\$/;\n \$items = split //, \'abc\';\n \$string //= "bar";\n for my \$key (keys %\$p)\n {\n if(\${\$vt.\'::property\'}) {\n \$o->{\$key . \'_real\'} = \$flds->{\$key};\n tie \$o->{\$key}, \'CMSBuilder::Property\', \$o, \$key;\n }\n }\n \$o->save if delete \$o->{\'_save_after_load\'};\n\n # GH-117\n my \$g = glob("/usr/bin/*");\n\n return \$o;\n}\n\n__DATA__\n@@ layouts/default.html.ep\n<!DOCTYPE html>\n<html>\n <head><title><%= title %></title></head>\n <body><%= content %></body>\n</html>\n__END__\n\n=head1 NAME\nPOD till the end of file\n',
|
||||
'pf':
|
||||
'# from the PF FAQ: http://www.openbsd.org/faq/pf/example1.html\n\n# macros\n\nint_if="xl0"\n\ntcp_services="{ 22, 113 }"\nicmp_types="echoreq"\n\ncomp3="192.168.0.3"\n\n# options\n\nset block-policy return\nset loginterface egress\nset skip on lo\n\n# FTP Proxy rules\n\nanchor "ftp-proxy/*"\n\npass in quick on \$int_if inet proto tcp to any port ftp \\\n divert-to 127.0.0.1 port 8021\n\n# match rules\n\nmatch out on egress inet from !(egress:network) to any nat-to (egress:0)\n\n# filter rules\n\nblock in log\npass out quick\n\nantispoof quick for { lo \$int_if }\n\npass in on egress inet proto tcp from any to (egress) \\\n port \$tcp_services\n\npass in on egress inet proto tcp to (egress) port 80 rdr-to \$comp3\n\npass in inet proto icmp all icmp-type \$icmp_types\n\npass in on \$int_if\n',
|
||||
'pgsql':
|
||||
'BEGIN;\nSELECT sum(salary) OVER w, avg(salary) OVER w\n FROM empsalary\n WINDOW w AS (PARTITION BY depname ORDER BY salary DESC);\nEND;\n\nCREATE FUNCTION days_of_week() RETURNS SETOF text AS \$\$\nBEGIN\n FOR i IN 7 .. 13 LOOP\n RETURN NEXT to_char(to_date(i::text,\'J\'),\'TMDy\');\n END LOOP;\nEND;\n\$\$ STABLE LANGUAGE plpgsql;\n',
|
||||
'php':
|
||||
'require_once \'Zend/Uri/Http.php\';\n\nnamespace Location\\Web;\n\ninterface Factory\n{\n static function _factory();\n}\n\nabstract class URI extends BaseURI implements Factory\n{\n abstract function test();\n\n public static \$st1 = 1;\n const ME = "Yo";\n var \$list = NULL;\n private \$var;\n\n /**\n * Returns a URI\n *\n * @return URI\n */\n static public function _factory(\$stats = array(), \$uri = \'http\')\n {\n echo __METHOD__;\n \$uri = explode(\':\', \$uri, 0b10);\n \$schemeSpecific = isset(\$uri[1]) ? \$uri[1] : \'\';\n \$desc = \'Multi\nline description\';\n\n // Security check\n if (!ctype_alnum(\$scheme)) {\n throw new Zend_Uri_Exception(\'Illegal scheme\');\n }\n\n \$this->var = 0 - self::\$st;\n \$this->list = list(Array("1"=> 2, 2=>self::ME, 3 => \\Location\\Web\\URI::class));\n\n return [\n \'uri\' => \$uri,\n \'value\' => null,\n ];\n }\n}\n\necho URI::ME . URI::\$st1;\n\n__halt_compiler () ; datahere\ndatahere\ndatahere */\ndatahere\n',
|
||||
'plaintext':
|
||||
' id | description\n----+-------------\n 1 | one\n 2 | two\n 3 | three\n(3 rows)\n',
|
||||
'pony':
|
||||
'use "collections"\n\nclass StopWatch\n """\n A simple stopwatch class for performance micro-benchmarking\n """\n var _s: U64 = 0\n\n fun delta(): U64 =>\n Time.nanos() - _s\n\nactor LonelyPony\n """\n A simple manifestation of the lonely pony problem\n """\n var env: Env\n let sw: StopWatch = StopWatch\n\n new create(env\': Env) =>\n env = env\n',
|
||||
'powershell':
|
||||
'\$initialDate = [datetime]\'2013/1/8\'\n\n\$rollingDate = \$initialDate\n\ndo {\n \$client = New-Object System.Net.WebClient\n \$results = \$client.DownloadString("http://not.a.real.url")\n Write-Host "\$rollingDate.ToShortDateString() - \$results"\n \$rollingDate = \$rollingDate.AddDays(21)\n \$username = [System.Environment]::UserName\n} until (\$rollingDate -ge [datetime]\'2013/12/31\')\n',
|
||||
'processing':
|
||||
'import java.util.LinkedList;\nimport java.awt.Point;\n\nPGraphics pg;\nString load;\n\nvoid setup() {\n size(displayWidth, displayHeight, P3D);\n pg = createGraphics(displayWidth*2,displayHeight,P2D);\n pg.beginDraw();\n pg.background(255,255,255);\n //pg.smooth(8);\n pg.endDraw();\n}\nvoid draw(){\n background(255);\n}\n',
|
||||
'profile':
|
||||
' 261917242 function calls in 686.251 CPU seconds\n\n ncalls tottime filename:lineno(function)\n 152824 513.894 {method \'sort\' of \'list\' objects}\n 129590630 83.894 rrule.py:842(__cmp__)\n 129590630 82.439 {cmp}\n 153900 1.296 rrule.py:399(_iter)\n304393/151570 0.963 rrule.py:102(_iter_cached)\n',
|
||||
'prolog':
|
||||
'mergesort([],[]). % special case\nmergesort([A],[A]).\nmergesort([A,B|R],S) :-\n split([A,B|R],L1,L2),\n mergesort(L1,S1),\n mergesort(L2,S2),\n merge(S1,S2,S).\n\nsplit([],[],[]).\nsplit([A],[A],[]).\nsplit([A,B|R],[A|Ra],[B|Rb]) :- split(R,Ra,Rb).\n',
|
||||
'properties':
|
||||
'# .properties\n! Exclamation mark = comments, too\n\nkey1 = value1\nkey2 : value2\nkey3 value3\nkey\\ spaces multiline\\\n value4\nempty_key\n! Key can contain escaped chars\n\\:\\= = value5\n',
|
||||
'protobuf':
|
||||
'package languages.protobuf;\n\noption java_package = "org.highlightjs.languages.protobuf";\n\nmessage Customer {\n required int64 customer_id = 1;\n optional string name = 2;\n optional string real_name = 3 [default = "Anonymous"];\n optional Gender gender = 4;\n repeated string email_addresses = 5;\n\n optional bool is_admin = 6 [default = false]; // or should this be a repeated field in Account?\n\n enum Gender {\n MALE = 1,\n FEMALE = 2\n }\n}\n\nservice CustomerSearch {\n rpc FirstMatch(CustomerRequest) returns (CustomerResponse);\n rpc AllMatches(CustomerRequest) returns (CustomerResponse);\n}',
|
||||
'puppet':
|
||||
'# EC2 sample\n\nclass ec2utils {\n\n # This must include the path to the Amazon EC2 tools\n \$ec2path = ["/usr/bin", "/bin", "/usr/sbin", "/sbin",\n "/opt/ec2/ec2-api-tools/bin",\n "/opt/ec2/aws-elb-tools/bin"]\n\n define elasticip (\$instanceid, \$ip)\n {\n exec { "ec2-associate-address-\$name":\n logoutput => on_failure,\n environment => \$ec2utils::ec2env,\n path => \$ec2utils::ec2path,\n command => "ec2assocaddr \$ip \\\n -i \$instanceid",\n # Only do this when necessary\n unless => "test `ec2daddr \$ip | awk \'{print \\\$3}\'` == \$instanceid",\n }\n }\n\n mount { "\$mountpoint":\n device => \$devicetomount,\n ensure => mounted,\n fstype => \$fstype,\n options => \$mountoptions,\n require => [ Exec["ec2-attach-volume-\$name"],\n File["\$mountpoint"]\n ],\n }\n\n}\n',
|
||||
'purebasic':
|
||||
'; PureBASIC 5 - Syntax Highlighting Example\n\nEnumeration Test 3 Step 10\n #Constant_One ; Will be 3\n #Constant_Two ; Will be 13\nEndEnumeration\n\nA.i = #Constant_One\nB = A + 3\n\nSTRING.s = SomeProcedure("Hello World", 2, #Empty\$, #Null\$)\nESCAPED_STRING\$ = ~"An escaped (\\\\) string!\\nNewline..."\n\nFixedString.s{5} = "12345"\n\nMacro XCase(Type, Text)\n Type#Case(Text)\nEndMacro\n\nStrangeProcedureCall ("This command is split " +\n "over two lines") ; Line continuation example\n\nIf B > 3 : X\$ = "Concatenation of commands" : Else : X\$ = "Using colons" : EndIf\n\nDeclare.s Attach(String1\$, String2\$)\n\nProcedure.s Attach(String1\$, String2\$)\n ProcedureReturn String1\$+" "+String2\$\nEndProcedure \n',
|
||||
'python':
|
||||
'@requires_authorization\ndef somefunc(param1=\'\', param2=0):\n r\'\'\'A docstring\'\'\'\n if param1 > param2: # interesting\n print \'Gre\\\'ater\'\n return (param2 - param1 + 1 + 0b10l) or None\n\nclass SomeClass:\n pass\n\n>>> message = \'\'\'interpreter\n... prompt\'\'\'\n',
|
||||
'q':
|
||||
'select time, price by date,stock from quote where price=(max;price)fby stock\ndata:raze value flip trade\nselect vwap:size wavg price by 5 xbar time.minute from aapl where date within (.z.d-10;.z.d)\nf1:{[x;y;z] show (x;y+z);sum 1 2 3}\n.z.pc:{[handle] show -3!(`long\$.z.p;"Closed";handle)}\n// random normal distribution, e.g. nor 10\nnor:{\$[x=2*n:x div 2;raze sqrt[-2*log n?1f]*/:(sin;cos)@\\:(2*pi)*n?1f;-1_.z.s 1+x]}\n\nmode:{where g=max g:count each group x} // mode function',
|
||||
'qml':
|
||||
'/****************************************************************************\n** QML with Highlight.js **/\nimport QtQuick 2.5 // good version\n\nWindow {\n id: root\n width: 1024; height: 600\n color: "black"\n property int highestZ: 0 // 0 is lowest, +infinity is highest\n property real defaultSize = 200.1\n signal activated(real xPosition, real yPosition)\n // show the file picker\n FileDialog {\n id:fileDialog // an id in a comment should not be detected\n title: "Choose a folder with some images"\n onAccepted: folderModel.folder = fileUrl + "/" // if this is on property\n }\n Flickable {\n id: flickableproperty\n contentHeight: height * surfaceViewportRatio\n property real zRestore: 0\n Behavior on scale { NumberAnimation { duration: 200 } }\n Repeater {\n model: FolderListModel {\n id: folderModel\n nameFilters: ["*.png", "*.jpg", "*.gif"]\n }\n Component.onCompleted: {\n var x;\n x = Math.random() * root.width - width / 2\n rotation = Math.random() * 13 - 6\n if (pinch.scale > 0) {\n photoFrame.rotation = 0;\n photoFrame.scale = Math.min(root.width, root.height) / Math.max(image.sourceSize.width, image.sourceSize.height) * 0.85\n } else {\n photoFrame.rotation = pinch.previousAngle\n photoFrame.scale = pinch.previousScale\n }\n }\n function setFrameColor() {\n if (currentFrame)\n currentFrame.border.color = "black";\n currentFrame = photoFrame;\n }\n }\n }\n Timer { id: fadeTimer; interval: 1000; onTriggered: { hfade.start(); vfade.start() } }\n Component.onCompleted: fileDialog.open()\n}\n',
|
||||
'r':
|
||||
'library(ggplot2)\n\ncentre <- function(x, type, ...) {\n switch(type,\n mean = mean(x),\n median = median(x),\n trimmed = mean(x, trim = .1))\n}\n\nmyVar1\nmyVar.2\ndata\$x\nfoo "bar" baz\n# test "test"\n"test # test"\n\n(123) (1) (10) (0.1) (.2) (1e-7)\n(1.2e+7) (2e) (3e+10) (0x0) (0xa)\n(0xabcdef1234567890) (123L) (1L)\n(0x10L) (10000000L) (1e6L) (1.1L)\n(1e-3L) (4123.381E-10i)\n(3.) (3.E10) # BUG: .E10 should be part of number\n\n# Numbers in some different contexts\n1L\n0x40\n.234\n3.\n1L + 30\nplot(cars, xlim=20)\nplot(cars, xlim=0x20)\nfoo<-30\nmy.data.3 <- read() # not a number\nc(1,2,3)\n1%%2\n\n"this is a quote that spans\nmultiple lines\n\\"\n\nis this still a quote? it should be.\n# even still!\n\n" # now we\'re done.\n\n\'same for\nsingle quotes #\'\n\n# keywords\nNULL, NA, TRUE, FALSE, Inf, NaN, NA_integer_,\nNA_real_, NA_character_, NA_complex_, function,\nwhile, repeat, for, if, in, else, next, break,\n..., ..1, ..2\n\n# not keywords\nthe quick brown fox jumped over the lazy dogs\nnull na true false inf nan na_integer_ na_real_\nna_character_ na_complex_ Function While Repeat\nFor If In Else Next Break .. .... "NULL" `NULL` \'NULL\'\n\n# operators\n+, -, *, /, %%, ^, >, >=, <, <=, ==, !=, !, &, |, ~,\n->, <-, <<-, \$, :, ::\n\n# infix operator\nfoo %union% bar\n%"test"%\n`"test"`\n\n',
|
||||
'reasonml':
|
||||
'/* This is a\n multiline\n comment */\n\ntype point = {\n x: float,\n y: float,\n};\n\nlet some_string = "this is a string";\n\nlet rec length = lst =>\n switch (lst) {\n | [] => 0\n | [head, ...tail] => 1 + length(tail)\n };\n\ntype result(\'a, \'b) =\n | Ok(\'a)\n | Error(\'b);\n\nlet promisify = (res: result(\'a, \'b)) : Js.Promise.t(\'a) =>\n switch (res) {\n | Ok(a) => Js.Promise.resolve(a)\n | Error(b) => Js.Promise.reject(b)\n };\n\nexception Test;\n\nmodule MakeFFI = (T: {type t;}) => {\n [@bs.module] external ffi : string => T.t = "";\n};\n\ntype expression =\n | Const(float)\n | Var(string)\n | Sum(expression, expression) /* e1 + e2 */\n | Diff(expression, expression) /* e1 - e2 */\n | Prod(expression, expression) /* e1 * e2 */\n | Quot(expression, expression); /* e1 / e2 */\n\nclass point = {\n as _;\n val mutable x = 0;\n pub get_x = x;\n pri move = d => x = x + d;\n};\n',
|
||||
'rib':
|
||||
'FrameBegin 0\nDisplay "Scene" "framebuffer" "rgb"\nOption "searchpath" "shader" "+&:/home/kew"\nOption "trace" "int maxdepth" [4]\nAttribute "visibility" "trace" [1]\nAttribute "irradiance" "maxerror" [0.1]\nAttribute "visibility" "transmission" "opaque"\nFormat 640 480 1.0\nShadingRate 2\nPixelFilter "catmull-rom" 1 1\nPixelSamples 4 4\nProjection "perspective" "fov" 49.5502811377\nScale 1 1 -1\n\nWorldBegin\n\nReadArchive "Lamp.002_Light/instance.rib"\nSurface "plastic"\nReadArchive "Cube.004_Mesh/instance.rib"\n# ReadArchive "Sphere.010_Mesh/instance.rib"\n# ReadArchive "Sphere.009_Mesh/instance.rib"\nReadArchive "Sphere.006_Mesh/instance.rib"\n\nWorldEnd\nFrameEnd\n',
|
||||
'roboconf':
|
||||
'# This is a comment\nimport toto.graph;\n\n##\n# Facet\n##\nfacet VM {\n installer: iaas;\n}\n\n# Components\nVM_ec2 {\n facets: VM;\n children: cluster-node, mysql;\n}\n\nVM_openstack {\n facets: VM;\n children: cluster-node, mysql;\n}\n\ncluster-node {\n alias: a cluster node;\n installer: puppet;\n exports: ip, port, optional-property1, optional_property2;\n imports: cluster-node.ip (optional), cluster-node.port (optional), mysql.ip, mysql.port;\n}\n\nmysql {\n alias: a MySQL database;\n installer: puppet;\n exports: ip, port;\n}\n\n##\n# Normally, instances are defined in another file...\n##\ninstance of VM_ec2 {\n name: VM_;\n count: 3;\n my-instance-property: whatever;\n \n instance of cluster-node {\n name: cluster node; # An in-line comment\n }\n}\n\ninstance of VM_openstack {\n name: VM_database;\n \n instance of mysql {\n name: mysql;\n }\n}\n',
|
||||
'routeros':
|
||||
'# Берем список DNS серверов из /ip dns\n # Проверяем их доступность, \n# и только рабочие прописываем в настройки DHCP сервера\n:global ActiveDNSServers []\n:local PingResult 0\n:foreach serv in=[/ip dns get servers] do={\n :do {:set PingResult [ping \$serv count=3]} on-error={:set PingResult 0}\n :if (\$PingResult=3) do={ :set ActiveDNSServers (\$ActiveDNSServers,\$serv) }\n# отладочный вывод в журнал \n :log info "Server: \$serv, Ping-result: \$PingResult";\n}\n\n/ip dhcp-server network set [find address=192.168.254.0/24] dns-server=\$ActiveDNSServers\n\n#--- FIX TTL ----\n/ip firewall mangle chain=postrouting action=change-ttl new-ttl=set:128 comment="NAT hide" \n\n',
|
||||
'rsl':
|
||||
'#define TEST_DEFINE 3.14\n/* plastic surface shader\n *\n * Pixie is:\n * (c) Copyright 1999-2003 Okan Arikan. All rights reserved.\n */\n\nsurface plastic (float Ka = 1, Kd = 0.5, Ks = 0.5, roughness = 0.1;\n color specularcolor = 1;) {\n normal Nf = faceforward (normalize(N),I);\n Ci = Cs * (Ka*ambient() + Kd*diffuse(Nf)) + specularcolor * Ks *\n specular(Nf,-normalize(I),roughness);\n Oi = Os;\n Ci *= Oi;\n}\n',
|
||||
'ruby':
|
||||
'# The Greeter class\nclass Greeter\n def initialize(name)\n @name = name.capitalize\n end\n\n def salute\n puts "Hello #{@name}!"\n end\nend\n\ng = Greeter.new("world")\ng.salute\n',
|
||||
'ruleslanguage':
|
||||
'//This is a comment\nABORT "You experienced an abort.";\nWARN "THIS IS A WARNING";\nCALL "RIDER_X";\nDONE;\nFOR EACH X IN CSV_FILE "d:\\lodestar\\user\\d377.lse"\n LEAVE FOR;\nEND FOR;\nIF ((BILL_KW = 0) AND (KW > 0)) THEN\nEND IF;\nINCLUDE "R1";\nLEAVE RIDER;\nSELECT BILL_PERIOD\n WHEN "WINTER"\n BLOCK KWH\n FROM 0 TO 400 CHARGE \$0.03709\n FROM 400 CHARGE \$0.03000\n TOTAL \$ENERGY_CHARGE_WIN;\n WHEN "SUMMER"\n \$VOLTAGE_DISCOUNT_SUM = \$0.00\n OTHERWISE\n \$VOLTAGE_DISCOUNT_SUM = \$1.00\nEND SELECT;\n/* Report top five peaks */\nLABEL PK.NM "Peak Number";\nSAVE_UPDATE MV TO TABLE "METERVALUE";\n\nFOR EACH INX IN ARRAYUPPERBOUND(#MYARRAY[])\n #MYARRAY[INX].VALUE = 2;\n CLEAR #MYARRAY[];\nEND FOR\n\n//Interval Data\nHNDL_1_ADD_EDI = INTDADDATTRIBUTE(HNDL_1, "EDI_TRANSACTION", EDI_ID);\nHNDL_1_ADD_VAL_MSG = INTDADDVMSG(HNDL_1,"Missing (Status Code 9) values found");\nEMPTY_HNDL = INTDCREATEHANDLE(\'05/03/2006 00:00:00\', \'05/03/2006 23:59:59\', 3600, "Y", "0", " ");\n',
|
||||
'rust':
|
||||
'#[derive(Debug)]\npub enum State {\n Start,\n Transient,\n Closed,\n}\n\nimpl From<&\'a str> for State {\n fn from(s: &\'a str) -> Self {\n match s {\n "start" => State::Start,\n "closed" => State::Closed,\n _ => unreachable!(),\n }\n }\n}\n',
|
||||
'sas':
|
||||
'/**********************************************************************\n * Program: example.sas\n * Purpose: SAS Example for HighlightJS Plug-in\n **********************************************************************/\n\n%put Started at %sysfunc(putn(%sysfunc(datetime()), datetime.));\noptions\n errors = 20 /* Maximum number of prints of repeat errors */\n fullstimer /* Detailed timer after each step execution */\n;\n\n%let maindir = /path/to/maindir;\n%let outdir = &maindir/out.;\n\nsystask command "mkdir -p &outdir." wait;\nlibname main "&maindir" access = readonly;\n\ndata testing;\n input name \$ number delimiter = ",";\n datalines;\n John,1\n Mary,2\n Jane,3\n ;\n if number > 1 then final = 0;\n else do;\n final = 1;\n end;\nrun;\n\n%macro testMacro(positional, named = value);\n %put positional = &positional.;\n %put named = &named.;\n%mend testMacro;\n%testMacro(positional, named = value);\n\ndm \'clear log output odsresults\';\n\nproc datasets lib = work kill noprint; quit;\nlibname _all_ clear;\n\ndata _null_;\n set sashelp.macro(\n keep = name\n where = (scope = "global");\n );\n call symdel(name);\nrun;\n',
|
||||
'scala':
|
||||
'/**\n * A person has a name and an age.\n */\ncase class Person(name: String, age: Int)\n\nabstract class Vertical extends CaseJeu\ncase class Haut(a: Int) extends Vertical\ncase class Bas(name: String, b: Double) extends Vertical\n\nsealed trait Ior[+A, +B]\ncase class Left[A](a: A) extends Ior[A, Nothing]\ncase class Right[B](b: B) extends Ior[Nothing, B]\ncase class Both[A, B](a: A, b: B) extends Ior[A, B]\n\ntrait Functor[F[_]] {\n def map[A, B](fa: F[A], f: A => B): F[B]\n}\n\n// beware Int.MinValue\ndef absoluteValue(n: Int): Int =\n if (n < 0) -n else n\n\ndef interp(n: Int): String =\n s"there are \$n \${color} balloons.\\n"\n\ntype ξ[A] = (A, A)\n\ntrait Hist { lhs =>\n def ⊕(rhs: Hist): Hist\n}\n\ndef gsum[A: Ring](as: Seq[A]): A =\n as.foldLeft(Ring[A].zero)(_ + _)\n\nval actions: List[Symbol] =\n \'init :: \'read :: \'write :: \'close :: Nil\n\ntrait Cake {\n type T;\n type Q\n val things: Seq[T]\n\n abstract class Spindler\n\n def spindle(s: Spindler, ts: Seq[T], reversed: Boolean = false): Seq[Q]\n}\n\nval colors = Map(\n "red" -> 0xFF0000,\n "turquoise" -> 0x00FFFF,\n "black" -> 0x000000,\n "orange" -> 0xFF8040,\n "brown" -> 0x804000)\n\nlazy val ns = for {\n x <- 0 until 100\n y <- 0 until 100\n} yield (x + y) * 33.33\n',
|
||||
'scheme':
|
||||
';; Calculation of Hofstadter\'s male and female sequences as a list of pairs\n\n(define (hofstadter-male-female n)\n(letrec ((female (lambda (n)\n (if (= n 0)\n 1\n (- n (male (female (- n 1)))))))\n (male (lambda (n)\n (if (= n 0)\n 0\n (- n (female (male (- n 1))))))))\n (let loop ((i 0))\n (if (> i n)\n \'()\n (cons (cons (female i)\n (male i))\n (loop (+ i 1)))))))\n\n(hofstadter-male-female 8)\n\n(define (find-first func lst)\n(call-with-current-continuation\n (lambda (return-immediately)\n (for-each (lambda (x)\n (if (func x)\n (return-immediately x)))\n lst)\n #f)))\n',
|
||||
'scilab':
|
||||
'// A comment\nfunction I = foo(dims, varargin)\n d=[1; matrix(dims(1:\$-1),-1,1)]\n for i=1:size(varargin)\n if varargin(i)==[] then\n I=[],\n return;\n end\n end\nendfunction\n\nb = cos(a) + cosh(a);\nbar_matrix = [ "Hello", "world" ];\nfoo_matrix = [1, 2, 3; 4, 5, 6];\n',
|
||||
'scss':
|
||||
'@import "compass/reset";\n\n// variables\n\$colorGreen: #008000;\n\$colorGreenDark: darken(\$colorGreen, 10);\n\n@mixin container {\n max-width: 980px;\n}\n\n// mixins with parameters\n@mixin button(\$color:green) {\n @if (\$color == green) {\n background-color: #008000;\n }\n @else if (\$color == red) {\n background-color: #B22222;\n }\n}\n\nbutton {\n @include button(red);\n}\n\ndiv,\n.navbar,\n#header,\ninput[type="input"] {\n font-family: "Helvetica Neue", Arial, sans-serif;\n width: auto;\n margin: 0 auto;\n display: block;\n}\n\n.row-12 > [class*="spans"] {\n border-left: 1px solid #B5C583;\n}\n\n// nested definitions\nul {\n width: 100%;\n padding: {\n left: 5px; right: 5px;\n }\n li {\n float: left; margin-right: 10px;\n .home {\n background: url(\'http://placehold.it/20\') scroll no-repeat 0 0;\n }\n }\n}\n\n.banner {\n @extend .container;\n}\n\na {\n color: \$colorGreen;\n &:hover { color: \$colorGreenDark; }\n &:visited { color: #c458cb; }\n}\n\n@for \$i from 1 through 5 {\n .span#{\$i} {\n width: 20px*\$i;\n }\n}\n\n@mixin mobile {\n @media screen and (max-width : 600px) {\n @content;\n }\n}',
|
||||
'shell':
|
||||
'\$ echo \$EDITOR\nvim\n\$ git checkout master\nSwitched to branch \'master\'\nYour branch is up-to-date with \'origin/master\'.\n\$ git push\nEverything up-to-date\n\$ echo \'All\n> done!\'\nAll\ndone!\n',
|
||||
'smali':
|
||||
'.class public Lcom/test/Preferences;\n.super Landroid/preference/PreferenceActivity;\n.source "Preferences.java"\n\n\n# instance fields\n.field private PACKAGE_NAME:Ljava/lang/String;\n\n\n# direct methods\n.method public constructor <init>()V\n .registers 1\n .annotation build Landroid/annotation/SuppressLint;\n value = {\n "InlinedApi"\n }\n .end annotation\n\n .prologue\n .line 25\n invoke-direct {p0}, Landroid/preference/PreferenceActivity;-><init>()V\n\n const-string v4, "ASDF!"\n\n .line 156\n .end local v0 #customOther:Landroid/preference/Preference;\n .end local v1 #customRate:Landroid/preference/Preference;\n .end local v2 #hideApp:Landroid/preference/Preference;\n :cond_56\n\n .line 135\n invoke-static {p1}, Lcom/google/ads/AdActivity;->b(Lcom/google/ads/internal/d;)Lcom/google/ads/internal/d;\n\n .line 140\n :cond_e\n monitor-exit v1\n :try_end_f\n .catchall {:try_start_5 .. :try_end_f} :catchall_30\n\n .line 143\n invoke-virtual {p1}, Lcom/google/ads/internal/d;->g()Lcom/google/ads/m;\n\n move-result-object v0\n\n iget-object v0, v0, Lcom/google/ads/m;->c:Lcom/google/ads/util/i\$d;\n\n invoke-virtual {v0}, Lcom/google/ads/util/i\$d;->a()Ljava/lang/Object;\n\n move-result-object v0\n\n check-cast v0, Landroid/app/Activity;\n\n .line 144\n if-nez v0, :cond_33\n\n .line 145\n const-string v0, "activity was null while launching an AdActivity."\n\n invoke-static {v0}, Lcom/google/ads/util/b;->e(Ljava/lang/String;)V\n\n .line 160\n :goto_22\n return-void\n\n .line 136\n :cond_23\n :try_start_23\n invoke-static {}, Lcom/google/ads/AdActivity;->c()Lcom/google/ads/internal/d;\n\n move-result-object v0\n\n if-eq v0, p1, :cond_e\n\n return-void\n.end method\n',
|
||||
'smalltalk':
|
||||
'Object>>method: num\n "comment 123"\n | var1 var2 |\n (1 to: num) do: [:i | |var| ^i].\n Klass with: var1.\n Klass new.\n arr := #(\'123\' 123.345 #hello Transcript var \$@).\n arr := #().\n var2 = arr at: 3.\n ^ self abc\n\nheapExample\n "HeapTest new heapExample"\n "Multiline\n decription"\n | n rnd array time sorted |\n n := 5000.\n "# of elements to sort"\n rnd := Random new.\n array := (1 to: n)\n collect: [:i | rnd next].\n "First, the heap version"\n time := Time\n millisecondsToRun: [sorted := Heap withAll: array.\n 1\n to: n\n do: [:i |\n sorted removeFirst.\n sorted add: rnd next]].\n Transcript cr; show: \'Time for Heap: \' , time printString , \' msecs\'.\n "The quicksort version"\n time := Time\n millisecondsToRun: [sorted := SortedCollection withAll: array.\n 1\n to: n\n do: [:i |\n sorted removeFirst.\n sorted add: rnd next]].\n Transcript cr; show: \'Time for SortedCollection: \' , time printString , \' msecs\'\n',
|
||||
'sml':
|
||||
'structure List : LIST =\n struct\n\n val op + = InlineT.DfltInt.+\n\n datatype list = datatype list\n\n exception Empty = Empty\n\n fun last [] = raise Empty\n | last [x] = x\n | last (_::r) = last r\n\n fun loop ([], []) = EQUAL\n | loop ([], _) = LESS\n | loop (_, []) = GREATER\n | loop (x :: xs, y :: ys) =\n (case compare (x, y) of\n EQUAL => loop (xs, ys)\n | unequal => unequal)\n in\n loop\n end\n\n end (* structure List *)\n\n',
|
||||
'sqf':
|
||||
'/***\n Arma Scripting File\n Edition: 1.66\n***/\n\n// Enable eating to improve health.\n_unit addAction ["Eat Energy Bar", {\n if (_this getVariable ["EB_NumActivation", 0] > 0) then {\n _this setDamage (0 max (damage _this - 0.25));\n } else {\n hint "You have eaten it all";\n };\n // 4 - means something...\n Z_obj_vip = nil;\n [_boat, ["Black", 1], true] call BIS_fnc_initVehicle;\n}];\n',
|
||||
'sql':
|
||||
'CREATE TABLE "topic" (\n "id" serial NOT NULL PRIMARY KEY,\n "forum_id" integer NOT NULL,\n "subject" varchar(255) NOT NULL\n);\nALTER TABLE "topic"\nADD CONSTRAINT forum_id FOREIGN KEY ("forum_id")\nREFERENCES "forum" ("id");\n\n-- Initials\ninsert into "topic" ("forum_id", "subject")\nvalues (2, \'D\'\'artagnian\');\n',
|
||||
'stan':
|
||||
'// Multivariate Regression Example\n// Taken from stan-reference-2.8.0.pdf p.66\n\ndata {\n int<lower=0> N; // num individuals\n int<lower=1> K; // num ind predictors\n int<lower=1> J; // num groups\n int<lower=1> L; // num group predictors\n int<lower=1,upper=J> jj[N]; // group for individual\n matrix[N,K] x; // individual predictors\n row_vector[L] u[J]; // group predictors\n vector[N] y; // outcomes\n}\nparameters {\n corr_matrix[K] Omega; // prior correlation\n vector<lower=0>[K] tau; // prior scale\n matrix[L,K] gamma; // group coeffs\n vector[K] beta[J]; // indiv coeffs by group\n real<lower=0> sigma; // prediction error scale\n}\nmodel {\n tau ~ cauchy(0,2.5);\n Omega ~ lkj_corr(2);\n to_vector(gamma) ~ normal(0, 5);\n {\n row_vector[K] u_gamma[J];\n for (j in 1:J)\n u_gamma[j] <- u[j] * gamma;\n beta ~ multi_normal(u_gamma, quad_form_diag(Omega, tau));\n }\n {\n vector[N] x_beta_jj;\n for (n in 1:N)\n x_beta_jj[n] <- x[n] * beta[jj[n]];\n y ~ normal(x_beta_jj, sigma);\n }\n}\n\n# Note: Octothorpes indicate comments, too!\n',
|
||||
'stata':
|
||||
'program define gr_log\nversion 6.0\n\nlocal or = `2\'\nlocal xunits = `3\'\nlocal b1 = ln(`or\')\n\n* make summary of logistic data from equation\nset obs `xunits\'\ngenerate pgty = 1 - 1/(1 + exp(score))\n/**\n * Comment 1\n*/\nreg y x\n* Comment 2\nreg y2 x //comment 3\nThis is a `loc\' \$glob \${glob2}\nThis is a `"string " "\' "string`1\'two\${hi}" bad `"string " "\' good `"string " "\'\n\n//Limit to just the project ados\ncap adopath - SITE\ncap adopath - PLUS\n/*cap adopath - PERSONAL\ncap adopath - OLDPLACE*/\nadopath ++ "\${dir_base}/code/ado/"\nA string `"Wow"\'. `""one" "two""\'\nA `local\' em`b\'ed\na global \${dir_base} \$dir_base em\${b}ed\n\nforval i=1/4{\n if `i\'==2{\n cap reg y x1, robust\n local x = ln(4)\n local x =ln(4)\n local ln = ln\n }\n}\n \n* add mlibs in the new adopath to the index\nmata: mata mlib index',
|
||||
'step21':
|
||||
'ISO-10303-21;\nHEADER;\nFILE_DESCRIPTION((\'\'),\'2;1\');\nFILE_NAME(\'CUBE_4SQUARE\',\'2013-11-29T\',(\'acook\'),(\'\'),\n\'SOMETHINGCAD BY SOME CORPORATION, 2012130\',\n\'SOMETHINGCAD BY SOME CORPORATION, 2012130\',\'\');\nFILE_SCHEMA((\'CONFIG_CONTROL_DESIGN\'));\nENDSEC;\n/* file written by SomethingCAD */\nDATA;\n#1=DIRECTION(\'\',(1.E0,0.E0,0.E0));\n#2=VECTOR(\'\',#1,4.E0);\n#3=CARTESIAN_POINT(\'\',(-2.E0,-2.E0,-2.E0));\n#4=LINE(\'\',#3,#2);\n#5=DIRECTION(\'\',(0.E0,1.E0,0.E0));\n#6=VECTOR(\'\',#5,4.E0);\n#7=CARTESIAN_POINT(\'\',(2.E0,-2.E0,-2.E0));\n#8=LINE(\'\',#7,#6);\n#9=DIRECTION(\'\',(-1.E0,0.E0,0.E0));\n#10=VECTOR(\'\',#9,4.E0);\n#11=CARTESIAN_POINT(\'\',(2.E0,2.E0,-2.E0));\n#12=LINE(\'\',#11,#10);\n#13=DIRECTION(\'\',(0.E0,-1.E0,0.E0));\n#14=VECTOR(\'\',#13,4.E0);\n#15=CARTESIAN_POINT(\'\',(-2.E0,2.E0,-2.E0));\n#16=LINE(\'\',#15,#14);\n#17=DIRECTION(\'\',(0.E0,0.E0,1.E0));\n#18=VECTOR(\'\',#17,4.E0);\n#19=CARTESIAN_POINT(\'\',(-2.E0,-2.E0,-2.E0));\n#20=LINE(\'\',#19,#18);\n#21=DIRECTION(\'\',(0.E0,0.E0,1.E0));\nENDSEC;\nEND-ISO-10303-21;\n',
|
||||
'stylus':
|
||||
'@import "nib"\n\n// variables\n\$green = #008000\n\$green_dark = darken(\$green, 10)\n\n// mixin/function\ncontainer()\n max-width 980px\n\n// mixin/function with parameters\nbuttonBG(\$color = green)\n if \$color == green\n background-color #008000\n else if \$color == red\n background-color #B22222\n\nbutton\n buttonBG(red)\n\n.blue-button\n buttonBG(blue)\n\n#content, .content\n font Tahoma, Chunkfive, sans-serif\n background url(\'hatch.png\')\n color #F0F0F0 !important\n width 100%\n',
|
||||
'subunit':
|
||||
'progress: 28704\ntime: 2016-07-05 12:17:02.290433Z\ntest: bzrlib.doc.api.DocFileTest(/usr/lib64/python2.7/site-packages/bzrlib/doc/api/branch.txt)\ntime: 2016-07-05 12:17:02.314892Z\nsuccessful: bzrlib.doc.api.DocFileTest(/usr/lib64/python2.7/site-packages/bzrlib/doc/api/branch.txt)\ntime: 2016-07-05 12:17:02.314939Z\ntime: 2016-07-05 12:17:02.314991Z\ntest: bzrlib.doc.api.DocFileTest(/usr/lib64/python2.7/site-packages/bzrlib/doc/api/transport.txt)\ntime: 2016-07-05 12:17:02.315665Z\nsuccessful: bzrlib.doc.api.DocFileTest(/usr/lib64/python2.7/site-packages/bzrlib/doc/api/transport.txt)\ntime: 2016-07-05 12:17:02.315691Z\ntime: 2016-07-05 12:17:02.315770Z\ntest: bzrlib.tests.blackbox.test_add.TestAdd.test_add_control_dir(pre-views)\ntime: 2016-07-05 12:17:02.368936Z\nsuccessful: bzrlib.tests.blackbox.test_add.TestAdd.test_add_control_dir(pre-views) [ multipart\n]\ntime: 2016-07-05 12:17:02.368993Z\ntime: 2016-07-05 12:17:02.369079Z\n',
|
||||
'swift':
|
||||
'import Foundation\n\n@objc class Person: Entity {\n var name: String!\n var age: Int!\n\n init(name: String, age: Int) {\n /* /* ... */ */\n }\n\n // Return a descriptive string for this person\n func description(offset: Int = 0) -> String {\n return "\\(name) is \\(age + offset) years old"\n }\n}\n',
|
||||
'taggerscript':
|
||||
'\$if(\$is_video(),video,\$if(\$is_lossless(),lossless,lossy))/\n\$if(\$is_video(),\n\$noop(Video track)\n\$if(\$ne(%album%,[non-album tracks]),\n\$if2(%albumartist%,%artist%) - %album%\$if(%discsubtitle%, - %discsubtitle%)/%_discandtracknumber%%title%,\nMusic Videos/%artist%/%artist% - %title%),\n\$if(\$eq(%compilation%,1),\n\$noop(Various Artist albums)\n\$firstalphachar(\$if2(%albumartistsort%,%artistsort%))/\$if2(%albumartist%,%artist%)/%album%\$if(%_releasecomment%, \\(%_releasecomment%\\),)/%_discandtracknumber%%artist% - %title%,\n\$noop(Single Artist Albums)\n\$firstalphachar(\$if2(%albumartistsort%,%artistsort%))/\$if2(%albumartist%,%artist%)/%album%\$if(%_releasecomment%, \\(%_releasecomment%\\),)/%_discandtracknumber%%title%\n))\n',
|
||||
'tap':
|
||||
'# Hardware architecture: x86_64\n# Timestamp: 2016-06-16 06:23 (GMT+1)\n# \nTAP version 13\n1..19\nok 1 - zdtm/static/conntracks # SKIP manual run only\nok 2 - zdtm/static/maps03 # SKIP manual run only\nok 3 - zdtm/static/mlock_setuid\nok 4 - zdtm/static/groups\nok 5 - zdtm/static/maps05\nok 6 - zdtm/static/pdeath_sig\nok 7 - zdtm/static/xids00\nok 8 - zdtm/static/proc-self\nok 9 - zdtm/static/file_fown\nok 10 - zdtm/static/eventfs00\nok 11 - zdtm/static/uptime_grow # SKIP manual run only\nok 12 - zdtm/static/signalfd00\nok 13 - zdtm/static/inotify_irmap\nok 14 - zdtm/static/fanotify00\nok 15 - zdtm/static/session00\nok 16 - zdtm/static/rlimits00\nok 17 - zdtm/static/maps04\nok 18 - zdtm/static/pty03\nok 19 - zdtm/static/pty02\n',
|
||||
'tcl':
|
||||
'package json\n\nsource helper.tcl\n# randomness verified by a die throw\nset ::rand 4\n\nproc give::recursive::count {base p} { ; # 2 mandatory params\n while {\$p > 0} {\n set result [expr \$result * \$base]; incr p -1\n }\n return \$result\n}\n\nset a {a}; set b "bcdef"; set lst [list "item"]\nputs [llength \$a\$b]\n\nset ::my::tid(\$id) \$::my::tid(def)\nlappend lst \$arr(\$idx) \$::my::arr(\$idx) \$ar(key)\nlreplace ::my::tid(\$id) 4 4\nputs \$::rand \${::rand} \${::AWESOME::component::variable}\n\nputs "\$x + \$y is\\t [expr \$x + \$y]"\n\nproc isprime x {\n expr {\$x>1 && ![regexp {^(oo+?)\\1+\$} [string repeat o \$x]]}\n}\n',
|
||||
'tex':
|
||||
'\\documentclass{article}\n\\usepackage[koi8-r]{inputenc}\n\\hoffset=0pt\n\\voffset=.3em\n\\tolerance=400\n\\newcommand{\\eTiX}{\\TeX}\n\\begin{document}\n\\section*{Highlight.js}\n\\begin{table}[c|c]\n\$\\frac 12\\, + \\, \\frac 1{x^3}\\text{Hello \\! world}\$ & \\textbf{Goodbye\\~ world} \\\\\\eTiX \$ \\pi=400 \$\n\\end{table}\nCh\\\'erie, \\c{c}a ne me pla\\^\\i t pas! % comment \\b\nG\\"otterd\\"ammerung~45\\%=34.\n\$\$\n \\int\\limits_{0}^{\\pi}\\frac{4}{x-7}=3\n\$\$\n\\end{document}\n',
|
||||
'thrift':
|
||||
'namespace * thrift.test\n\n/**\n * Docstring!\n */\nenum Numberz\n{\n ONE = 1,\n TWO,\n THREE,\n FIVE = 5,\n SIX,\n EIGHT = 8\n}\n\nconst Numberz myNumberz = Numberz.ONE;\n// the following is expected to fail:\n// const Numberz urNumberz = ONE;\n\ntypedef i64 UserId\n\nstruct Msg\n{\n 1: string message,\n 2: i32 type\n}\nstruct NestedListsI32x2\n{\n 1: list<list<i32>> integerlist\n}\nstruct NestedListsI32x3\n{\n 1: list<list<list<i32>>> integerlist\n}\nservice ThriftTest\n{\n void testVoid(),\n string testString(1: string thing),\n oneway void testInit()\n}',
|
||||
'tp':
|
||||
'/PROG ALL\n/ATTR\nOWNER = MNEDITOR;\nCOMMENT = "";\nPROG_SIZE = 3689;\nCREATE = DATE 14-05-13 TIME 17:03:06;\nMODIFIED = DATE 14-05-13 TIME 17:21:44;\nFILE_NAME = ;\nVERSION = 0;\nLINE_COUNT = 118;\nMEMORY_SIZE = 4365;\nPROTECT = READ_WRITE;\nTCD: STACK_SIZE = 0,\n TASK_PRIORITY = 50,\n TIME_SLICE = 0,\n BUSY_LAMP_OFF = 0,\n ABORT_REQUEST = 0,\n PAUSE_REQUEST = 0;\nDEFAULT_GROUP = 1,*,*,*,*;\nCONTROL_CODE = 00000000 00000000;\n/MN\n ! motion ;\nJ P[1:test point] 100% FINE ;\nJ P[1] 100.0sec CNT100 ;\nJ P[1] 100msec CNT R[1] ;\nL P[1] 100/sec FINE ;\nL P[1] 100cm/min CNT100 ;\nL P[1] 100.0inch/min CNT100 ;\nL P[1] 100deg/sec CNT100 ;\n ! indirect speed ;\nL P[1] R[1]sec CNT100 ;\n ! indirect indirect ;\nL PR[1] R[R[1]]msec CNT100 ;\n ! indirect destination ;\nL PR[R[1]] max_speed CNT100 ;\n ;\n ! assignment ;\n R[1]=R[2] ;\n ! indirect assignment ;\n R[R[1]]=R[2] ;\n ! system variables ;\n \$foo=\$bar[100].\$baz ;\n R[1]=\$FOO.\$BAR ;\n ;\n ! various keyword assignments ;\n PR[1]=LPOS ;\n PR[1]=JPOS ;\n PR[1]=UFRAME[1] ;\n PR[1]=UTOOL[1] ;\n PR[1]=P[1] ;\n PR[1,1:component]=5 ;\n SR[1:string reg]=SR[2]+AR[1] ;\n R[1]=SO[1:Cycle start] DIV SI[2:Remote] ;\n R[1]=UO[1:Cmd enabled] MOD UI[1:*IMSTP] ;\n ! mixed logic ;\n DO[1]=(DI[1] AND AR[1] AND F[1] OR TIMER[1]>TIMER_OVERFLOW[1]) ;\n F[1]=(ON) ;\n JOINT_MAX_SPEED[1]=5 ;\n LINEAR_MAX_SPEED=5 ;\n SKIP CONDITION DI[1]=OFF- ;\n PAYLOAD[R[1]] ;\n OFFSET CONDITION PR[1] ;\n UFRAME_NUM=1 ;\n UTOOL_NUM=1 ;\n UFRAME[1]=PR[1] ;\n UTOOL[1]=PR[1] ;\n RSR[1]=ENABLE ;\n RSR[AR[1]]=DISABLE ;\n UALM[1] ;\n TIMER[1]=START ;\n TIMER[1]=STOP ;\n TIMER[1]=RESET ;\n OVERRIDE=50% ;\n TOOL_OFFSET CONDITION PR[1] ;\n LOCK PREG ;\n UNLOCK PREG ;\n COL DETECT ON ;\n COL DETECT OFF ;\n COL GUARD ADJUST R[1] ;\n COL GUARD ADJUST 50 ;\n MONITOR TEST ;\n MONITOR END TEST ;\n R[1]=STRLEN SR[1] ;\n SR[1]=SUBSTR SR[2],R[3],R[4] ;\n R[1]=FINDSTR SR[1],SR[2] ;\n DIAG_REC[1,5,2] ;\n ;\n ! program calls ;\n CALL TEST ;\n CALL TEST(1,\'string\',SR[1],AR[1]) ;\n RUN TEST ;\n RUN TEST(1,\'string\',SR[1],AR[1]) ;\n ;\n ! conditionals ;\n IF R[1]=1,JMP LBL[5] ;\n IF R[1]=AR[1],CALL TEST ;\n IF (DI[1]),R[1]=(5) ;\n SELECT R[1]=1,JMP LBL[5] ;\n =2,CALL TEST ;\n ELSE,JMP LBL[100] ;\n FOR R[1]=1 TO R[2] ;\n ENDFOR ;\n ;\n ! wait statement ;\n WAIT 1.00(sec) ;\n WAIT R[5] ;\n WAIT DI[1]=ON ;\n WAIT DI[1]=ON+ ;\n WAIT ERR_NUM=1 ;\n WAIT (DI[1]=ON) ;\n ;\n ! jumps and labels ;\n JMP LBL[1] ;\n JMP LBL[R[1]] ;\n LBL[100] ;\n LBL[100:TEST] ;\n ;\n ! statements ;\n PAUSE ;\n ABORT ;\n ERROR_PROG=ALL ;\n RESUME_PROG[1]=TEST ;\n END ;\n MESSAGE[ASDF] ;\n ;\n ! comments ;\n --eg:ASDFASDFASDF ;\n // L P[9] 100mm/sec CNT100 ACC100 ;\n ;\n ! motion modifiers ;\nL P[1] 100mm/sec CNT100 ACC100 ;\nL P[1] 100mm/sec CNT100 ACC R[1] ;\nL P[1] 100mm/sec CNT100 Skip,LBL[1] ;\nL P[1] 100mm/sec CNT100 BREAK ;\nL P[1] 100mm/sec CNT100 Offset ;\nL P[1] 100mm/sec CNT100 PSPD50 ;\nL P[1] 100mm/sec CNT100 Offset,PR[1] ;\nL P[1] 100mm/sec CNT100 INC ;\nL P[1] 100mm/sec CNT100 RT_LDR[1] ;\nL P[1] 100mm/sec CNT100 AP_LD50 ;\nL P[1] 100mm/sec CNT100 Tool_Offset ;\nL P[1] 100mm/sec CNT100 Tool_Offset,PR[1] ;\nL P[1] 100mm/sec CNT100 Skip,LBL[1],PR[1]=LPOS ;\nL P[1] 100mm/sec CNT100 TB R[5]sec,CALL ALL ;\nL P[1] 100mm/sec CNT100 TA 0.00sec,AO[1]=R[5] ;\nL P[1] 100mm/sec CNT100 DB 0.0mm,CALL ALL ;\nL P[1] 100mm/sec CNT100 PTH ;\nL P[1] 100mm/sec CNT100 VOFFSET,VR[1] ;\n/POS\nP[1:"test"]{\n GP1:\n UF : 0, UT : 1, CONFIG : \'\',\n X = 550.000 mm, Y = 0.000 mm, Z = -685.000 mm,\n W = 180.000 deg, P = 0.000 deg, R = 0.000 deg\n};\n/END\n',
|
||||
'twig':
|
||||
'{% if posts|length %}\n {% for article in articles %}\n <div>\n {{ article.title|upper() }}\n\n {# outputs \'WELCOME\' #}\n </div>\n {% endfor %}\n{% endif %}\n\n{% set user = json_encode(user) %}\n\n{{ random([\'apple\', \'orange\', \'citrus\']) }}\n\n{{ include(template_from_string("Hello {{ name }}")) }}\n\n\n{#\nComments may be long and multiline.\nMarkup is <em>not</em> highlighted within comments.\n#}\n',
|
||||
'typescript':
|
||||
'class MyClass {\n public static myValue: string;\n constructor(init: string) {\n this.myValue = init;\n }\n}\nimport fs = require("fs");\nmodule MyModule {\n export interface MyInterface extends Other {\n myProperty: any;\n }\n}\ndeclare magicNumber number;\nmyArray.forEach(() => { }); // fat arrow syntax\n',
|
||||
'vala':
|
||||
'using DBus;\n\nnamespace Test {\n class Foo : Object {\n public signal void some_event (); // definition of the signal\n public void method () {\n some_event (); // emitting the signal (callbacks get invoked)\n }\n }\n}\n\n/* defining a class */\nclass Track : GLib.Object, Test.Foo { /* subclassing \'GLib.Object\' */\n public double mass; /* a public field */\n public double name { get; set; } /* a public property */\n private bool terminated = false; /* a private field */\n public void terminate() { /* a public method */\n terminated = true;\n }\n}\n\nconst ALL_UPPER_CASE = "you should follow this convention";\n\nvar t = new Track(); // same as: Track t = new Track();\nvar s = "hello"; // same as: string s = "hello";\nvar l = new List<int>(); // same as: List<int> l = new List<int>();\nvar i = 10; // same as: int i = 10;\n\n\n#if (ololo)\nRegex regex = /foo/;\n#endif\n\n/*\n * Entry point can be outside class\n */\nvoid main () {\n var long_string = """\n Example of "verbatim string".\n Same as in @"string" in C#\n """\n var foo = new Foo ();\n foo.some_event.connect (callback_a); // connecting the callback functions\n foo.some_event.connect (callback_b);\n foo.method ();\n}\n',
|
||||
'vbnet':
|
||||
'Import System\nImport System.IO\n#Const DEBUG = True\n\nNamespace Highlighter.Test\n \'\'\' <summary>This is an example class.</summary>\n Public Class Program\n Protected Shared hello As Integer = 3\n Private Const ABC As Boolean = False\n\n#Region "Code"\n \' Cheers!\n <STAThread()> _\n Public Shared Sub Main(ByVal args() As String, ParamArray arr As Object) Handles Form1.Click\n On Error Resume Next\n If ABC Then\n While ABC : Console.WriteLine() : End While\n For i As Long = 0 To 1000 Step 123\n Try\n System.Windows.Forms.MessageBox.Show(CInt("1").ToString())\n Catch ex As Exception \' What are you doing? Well...\n Dim exp = CType(ex, IOException)\n REM ORZ\n Return\n End Try\n Next\n Else\n Dim l As New System.Collections.List<String>()\n SyncLock l\n If TypeOf l Is Decimal And l IsNot Nothing Then\n RemoveHandler button1.Paint, delegate\n End If\n Dim d = New System.Threading.Thread(AddressOf ThreadProc)\n Dim a = New Action(Sub(x, y) x + y)\n Static u = From x As String In l Select x.Substring(2, 4) Where x.Length > 0\n End SyncLock\n Do : Laugh() : Loop Until hello = 4\n End If\n End Sub\n#End Region\n End Class\nEnd Namespace\n',
|
||||
'vbscript':
|
||||
'\' creating configuration storage and initializing with default values\nSet cfg = CreateObject("Scripting.Dictionary")\n\n\' reading ini file\nfor i = 0 to ubound(ini_strings)\n s = trim(ini_strings(i))\n\n \' skipping empty strings and comments\n if mid(s, 1, 1) <> "#" and len(s) > 0 then\n \' obtaining key and value\n parts = split(s, "=", -1, 1)\n\n if ubound(parts)+1 = 2 then\n parts(0) = trim(parts(0))\n parts(1) = trim(parts(1))\n\n \' reading configuration and filenames\n select case lcase(parts(0))\n case "uncompressed""_postfix" cfg.item("uncompressed""_postfix") = parts(1)\n case "f"\n options = split(parts(1), "|", -1, 1)\n if ubound(options)+1 = 2 then\n \' 0: filename, 1: options\n ff.add trim(options(0)), trim(options(1))\n end if\n end select\n end if\n end if\nnext',
|
||||
'vbscript-html':
|
||||
'<body>\n<%\nIf i < 10 Then\n response.write("Good morning!")\nEnd If\n%>\n</body>\n',
|
||||
'verilog':
|
||||
'`timescale 1ns / 1ps\n\n/**\n * counter: a generic clearable up-counter\n */\n\nmodule counter\n #(parameter WIDTH=64, NAME="world")\n (\n input clk,\n input ce,\n input arst_n,\n output reg [WIDTH-1:0] q\n );\n \n string name = "counter";\n localparam val0 = 12\'ha1f;\n localparam val1 = 12\'h1fa;\n localparam val2 = 12\'hfa1;\n\n // some child\n clock_buffer #(WIDTH) buffer_inst (\n .clk(clk),\n .ce(ce),\n .reset(arst_n)\n );\n\n // Simple gated up-counter with async clear\n\n always @(posedge clk or negedge arst_n) begin\n if (arst_n == 1\'b0) begin\n q <= {WIDTH {1\'b0}};\n end\n else begin\n q <= q;\n if (ce == 1\'b1) begin\n q <= q + 1;\n end\n end\n end\n\n function int add_one(int x);\n return x + 1;\n endfunction : add_one\n\n`ifdef SIMULATION\ninitial \$display("Hello %s", NAME);\n`endif\nendmodule : counter\n\nclass my_data extends uvm_data;\n int x, y;\n\n function add_one();\n x++;\n y++;\n endfunction : add_one\nendclass : my_data\n',
|
||||
'vhdl':
|
||||
'/*\n * RS-trigger with assynch. reset\n */\n\nlibrary ieee;\nuse ieee.std_logic_1164.all;\n\nentity RS_trigger is\n generic (T: Time := 0ns);\n port ( R, S : in std_logic;\n Q, nQ : out std_logic;\n reset, clock : in std_logic );\nend RS_trigger;\n\narchitecture behaviour of RS_trigger is\n signal QT: std_logic; -- Q(t)\nbegin\n process(clock, reset) is\n subtype RS is std_logic_vector (1 downto 0);\n begin\n if reset = \'0\' then\n QT <= \'0\';\n else\n if rising_edge(C) then\n if not (R\'stable(T) and S\'stable(T)) then\n QT <= \'X\';\n else\n case RS\'(R&S) is\n when "01" => QT <= \'1\';\n when "10" => QT <= \'0\';\n when "11" => QT <= \'X\';\n when others => null;\n end case;\n end if;\n end if;\n end if;\n end process;\n\n Q <= QT;\n nQ <= not QT;\nend architecture behaviour;\n',
|
||||
'vim':
|
||||
'if foo > 2 || has("gui_running")\n syntax on\n set hlsearch\nendif\n\nset autoindent\n\n" switch on highlighting\nfunction UnComment(fl, ll)\n while idx >= a:ll\n let srclines=getline(idx)\n let dstlines=substitute(srclines, b:comment, "", "")\n call setline(idx, dstlines)\n endwhile\nendfunction\n\nlet conf = {\'command\': \'git\'}\n',
|
||||
'x86asm':
|
||||
'section .text\nextern _MessageBoxA@16\n%if __NASM_VERSION_ID__ >= 0x02030000\nsafeseh handler ; register handler as "safe handler"\n%endif\n\nhandler:\n push dword 1 ; MB_OKCANCEL\n push dword caption\n push dword text\n push dword 0\n call _MessageBoxA@16\n sub eax,1 ; incidentally suits as return value\n ; for exception handler\n ret\n\nglobal _main\n_main: push dword handler\n push dword [fs:0]\n mov dword [fs:0], esp\n xor eax,eax\n mov eax, dword[eax] ; cause exception\n pop dword [fs:0] ; disengage exception handler\n add esp, 4\n ret\n\navx2: vzeroupper\n push rbx\n mov rbx, rsp\n sub rsp, 0h20\n vmovdqa ymm0, [rcx]\n vpaddb ymm0, [rdx]\n leave\n ret\n\ntext: db \'OK to rethrow, CANCEL to generate core dump\',0\ncaption:db \'SEGV\',0\n\nsection .drectve info\n db \'/defaultlib:user32.lib /defaultlib:msvcrt.lib \'\n',
|
||||
'xl':
|
||||
'import Animate\nimport SeasonsGreetingsTheme\nimport "myhelper.xl"\ntheme "SeasonsGreetings"\nfunction X:real -> sin(X*0.5) + 16#0.002\npage "A nice car",\n// --------------------------------------\n// Display car model on a pedestal\n// --------------------------------------\n clear_color 0, 0, 0, 1\n hand_scale -> 0.3\n\n // Display the background image\n background -4000,\n locally\n disable_depth_test\n corridor N:integer ->\n locally\n rotatez 60 * N\n translatex 1000\n rotatey 90\n color "white"\n texture "stars.png"\n texture_wrap true, true\n texture_transform\n translate (time + N) * 0.02 mod 1, 0, 0\n scale 0.2, 0.3, 0.3\n rectangle 0, 0, 100000, 1154\n',
|
||||
'xml':
|
||||
'<!DOCTYPE html>\n<title>Title</title>\n\n<style>body {width: 500px;}</style>\n\n<script type="application/javascript">\n function \$init() {return true;}\n</script>\n\n<body>\n <p checked class="title" id=\'title\'>Title</p>\n <!-- here goes the rest of the page -->\n</body>\n',
|
||||
'xquery':
|
||||
'xquery version "3.1";\n(:~\n : @author Duncan Paterson\n : @version 1.0:)\n\ndeclare variable \$local:num := math:log10(12345);\n\n(\nlet \$map := map { \'R\': \'red\', \'G\': \'green\', \'B\': \'blue\' }\nreturn (\n \$map?* (: 1. returns all values; same as: map:keys(\$map) ! \$map(.) :),\n \$map?R (: 2. returns the value associated with the key \'R\'; same as: \$map(\'R\') :),\n \$map?(\'G\',\'B\') (: 3. returns the values associated with the key \'G\' and \'B\' :)\n),\n\ndeclare function local:city(\$country as node()*) as element (country) {\nfor \$country in doc(\'factbook\')//country\nwhere \$country/@population > 100000000\nlet \$name := \$country/name[1]\nfor \$city in \$country//city[population gt 1000000]\ngroup by \$name\nreturn\n element country { attribute type { \$name },\n \$city/name }\n};\n\nreturn\n(\'A\', \'B\', \'C\') => count(),\n\n<root>{local:city(.) + \$local:num}</root>\n',
|
||||
'yaml':
|
||||
'---\n# comment\nstring_1: "Bar"\nstring_2: \'bar\'\nstring_3: bar\ninline_keys_ignored: sompath/name/file.jpg\nkeywords_in_yaml:\n - true\n - false\n - TRUE\n - FALSE\n - 21\n - 21.0\n - !!str 123\n"quoted_key": &foobar\n bar: foo\n foo:\n "foo": bar\n\nreference: *foobar\n\nmultiline_1: |\n Multiline\n String\nmultiline_2: >\n Multiline\n String\nmultiline_3: "\n Multiline string\n "\n\nansible_variables: "foo {{variable}}"\n\narray_nested:\n- a\n- b: 1\n c: 2\n- b\n- comment\n',
|
||||
'zephir':
|
||||
'function testBefore(<Test> a, var b = 5, int c = 10)\n{\n a->method1();\n\n return b + c;\n}\n\nnamespace Test;\n\nuse RuntimeException as RE;\n\n/**\n * Example comment\n */\nclass Test extends CustomClass implements TestInterface\n{\n const C1 = null;\n\n // Magic constant: http://php.net/manual/ru/language.constants.predefined.php\n const className = __CLASS__;\n\n public function method1()\n {\n int a = 1, b = 2;\n return a + b;\n }\n\n // See fn is allowed like shortcut\n public fn method2() -> <Test>\n {\n call_user_func(function() { echo "hello"; });\n\n\n [1, 2, 3, 4, 5]->walk(\n function(int! x) {\n return x * x;\n }\n );\n\n [1, 2, 3, 4, 5]->walk(\n function(_, int key) { echo key; }\n );\n\n array input = [1, 2, 3, 4, 5];\n\n input->walk(\n function(_, int key) { echo key; }\n );\n\n\n input->map(x => x * x);\n\n return this;\n }\n}\n',
|
||||
};
|
||||
160
pub/code_field-master/example/lib/custom_code_box.dart
Normal file
@ -0,0 +1,160 @@
|
||||
import 'package:example/code_snippets.dart';
|
||||
import 'package:example/themes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:code_text_field/code_text_field.dart';
|
||||
import 'package:highlight/languages/all.dart';
|
||||
|
||||
class CustomCodeBox extends StatefulWidget {
|
||||
final String language;
|
||||
final String theme;
|
||||
|
||||
const CustomCodeBox({Key? key, required this.language, required this.theme})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_CustomCodeBoxState createState() => _CustomCodeBoxState();
|
||||
}
|
||||
|
||||
class _CustomCodeBoxState extends State<CustomCodeBox> {
|
||||
String? language;
|
||||
String? theme;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
language = widget.language;
|
||||
theme = widget.theme;
|
||||
}
|
||||
|
||||
List<String?> get languageList {
|
||||
const TOP = <String>{
|
||||
"java",
|
||||
"cpp",
|
||||
"python",
|
||||
"javascript",
|
||||
"cs",
|
||||
"dart",
|
||||
"haskell",
|
||||
"ruby",
|
||||
};
|
||||
return <String?>[
|
||||
...TOP,
|
||||
null, // Divider
|
||||
...CODE_SNIPPETS.keys.where((el) => !TOP.contains(el))
|
||||
];
|
||||
}
|
||||
|
||||
List<String?> get themeList {
|
||||
const TOP = <String>{
|
||||
"monokai-sublime",
|
||||
"a11y-dark",
|
||||
"an-old-hope",
|
||||
"vs2015",
|
||||
"vs",
|
||||
"atom-one-dark",
|
||||
};
|
||||
return <String?>[
|
||||
...TOP,
|
||||
null, // Divider
|
||||
...THEMES.keys.where((el) => !TOP.contains(el))
|
||||
];
|
||||
}
|
||||
|
||||
Widget buildDropdown(Iterable<String?> choices, String value, IconData icon,
|
||||
Function(String?) onChanged) {
|
||||
return DropdownButton<String>(
|
||||
value: value,
|
||||
items: choices.map((String? value) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: value == null
|
||||
? Divider()
|
||||
: Text(value, style: TextStyle(color: Colors.white)),
|
||||
);
|
||||
}).toList(),
|
||||
icon: Icon(icon, color: Colors.white),
|
||||
onChanged: onChanged,
|
||||
dropdownColor: Colors.black87,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final codeDropdown =
|
||||
buildDropdown(languageList, language!, Icons.code, (val) {
|
||||
if (val == null) return;
|
||||
setState(() => language = val);
|
||||
});
|
||||
final themeDropdown =
|
||||
buildDropdown(themeList, theme!, Icons.color_lens, (val) {
|
||||
if (val == null) return;
|
||||
setState(() => theme = val);
|
||||
});
|
||||
final dropdowns = Row(children: [
|
||||
SizedBox(width: 12.0),
|
||||
codeDropdown,
|
||||
SizedBox(width: 12.0),
|
||||
themeDropdown,
|
||||
]);
|
||||
final codeField = InnerField(
|
||||
key: ValueKey("$language - $theme"),
|
||||
language: language!,
|
||||
theme: theme!,
|
||||
);
|
||||
return Column(children: [
|
||||
dropdowns,
|
||||
codeField,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
class InnerField extends StatefulWidget {
|
||||
final String language;
|
||||
final String theme;
|
||||
|
||||
const InnerField({Key? key, required this.language, required this.theme})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_InnerFieldState createState() => _InnerFieldState();
|
||||
}
|
||||
|
||||
class _InnerFieldState extends State<InnerField> {
|
||||
CodeController? _codeController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_codeController = CodeController(
|
||||
text: CODE_SNIPPETS[widget.language],
|
||||
patternMap: {
|
||||
r"\B#[a-zA-Z0-9]+\b": TextStyle(color: Colors.red),
|
||||
r"\B@[a-zA-Z0-9]+\b": TextStyle(
|
||||
fontWeight: FontWeight.w800,
|
||||
color: Colors.blue,
|
||||
),
|
||||
r"\B![a-zA-Z0-9]+\b":
|
||||
TextStyle(color: Colors.yellow, fontStyle: FontStyle.italic),
|
||||
},
|
||||
stringMap: {
|
||||
"bev": TextStyle(color: Colors.indigo),
|
||||
},
|
||||
language: allLanguages[widget.language],
|
||||
theme: THEMES[widget.theme],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_codeController?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CodeField(
|
||||
controller: _codeController!,
|
||||
textStyle: TextStyle(fontFamily: 'SourceCode'),
|
||||
);
|
||||
}
|
||||
}
|
||||
116
pub/code_field-master/example/lib/main.dart
Normal file
@ -0,0 +1,116 @@
|
||||
import 'package:example/custom_code_box.dart';
|
||||
// import 'package:example/readme/readme_examples.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
// ignore: import_of_legacy_library_into_null_safe
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
void main() {
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: 'Code field',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blueGrey,
|
||||
),
|
||||
home: HomePage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
HomePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_HomePageState createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future _launchInBrowser(String url) async {
|
||||
if (await canLaunch(url)) {
|
||||
await launch(
|
||||
url,
|
||||
forceSafariVC: false,
|
||||
forceWebView: false,
|
||||
headers: <String, String>{'my_header_key': 'my_header_value'},
|
||||
);
|
||||
} else {
|
||||
throw 'Could not launch $url';
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final preset = <String>[
|
||||
"dart|monokai-sublime",
|
||||
"python|atom-one-dark",
|
||||
"cpp|an-old-hope",
|
||||
"java|a11y-dark",
|
||||
"javascript|vs",
|
||||
];
|
||||
List<Widget> children = preset.map((e) {
|
||||
final parts = e.split('|');
|
||||
print(parts);
|
||||
final box = CustomCodeBox(
|
||||
language: parts[0],
|
||||
theme: parts[1],
|
||||
);
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: 32.0),
|
||||
child: box,
|
||||
);
|
||||
}).toList();
|
||||
final page = Center(
|
||||
child: Container(
|
||||
constraints: BoxConstraints(maxWidth: 900),
|
||||
padding: EdgeInsets.symmetric(vertical: 32.0),
|
||||
child: Column(children: children),
|
||||
),
|
||||
);
|
||||
|
||||
// return Scaffold(
|
||||
// appBar: AppBar(),
|
||||
// body: CodeEditor(),
|
||||
// );
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Color(0xFF363636),
|
||||
appBar: AppBar(
|
||||
backgroundColor: Color(0xff23241f),
|
||||
title: Text("CodeField demo"),
|
||||
// title: Text("Recursive Fibonacci"),
|
||||
centerTitle: false,
|
||||
actions: [
|
||||
TextButton.icon(
|
||||
style: TextButton.styleFrom(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.0),
|
||||
primary: Colors.white,
|
||||
),
|
||||
icon: Icon(FontAwesomeIcons.github),
|
||||
onPressed: () =>
|
||||
_launchInBrowser("https://github.com/BertrandBev/code_field"),
|
||||
label: Text("GITHUB"),
|
||||
),
|
||||
SizedBox(width: 8.0),
|
||||
],
|
||||
),
|
||||
body: SingleChildScrollView(child: page),
|
||||
// body: CodeEditor5(),
|
||||
);
|
||||
}
|
||||
}
|
||||
13
pub/code_field-master/example/lib/readme/fib.dart
Normal file
@ -0,0 +1,13 @@
|
||||
// An expensive but pretty
|
||||
// recursive implementation
|
||||
int fibonacci(int n) {
|
||||
if (n <= 1) return n;
|
||||
return fibonacci(n - 1)
|
||||
+ fibonacci(n - 2);
|
||||
}
|
||||
|
||||
void main() {
|
||||
print("Fibonacci sequence:");
|
||||
for (var n = 0; n < 10; n++)
|
||||
print(fibonacci(n));
|
||||
}
|
||||
272
pub/code_field-master/example/lib/readme/readme_examples.dart
Normal file
@ -0,0 +1,272 @@
|
||||
/*
|
||||
* Simple example
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:code_text_field/code_text_field.dart';
|
||||
// Import the language & theme
|
||||
import 'package:highlight/languages/dart.dart';
|
||||
import 'package:flutter_highlight/themes/monokai-sublime.dart';
|
||||
import 'package:flutter_highlight/themes/a11y-dark.dart';
|
||||
|
||||
class CodeEditor extends StatefulWidget {
|
||||
@override
|
||||
_CodeEditorState createState() => _CodeEditorState();
|
||||
}
|
||||
|
||||
class _CodeEditorState extends State<CodeEditor> {
|
||||
CodeController? _codeController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final source = "";
|
||||
// Instantiate the CodeController
|
||||
_codeController = CodeController(
|
||||
text: source,
|
||||
language: dart,
|
||||
theme: monokaiSublimeTheme,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_codeController?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CodeField(
|
||||
controller: _codeController!,
|
||||
textStyle: TextStyle(fontFamily: 'SourceCode'),
|
||||
expands: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CodeEditor1 extends StatefulWidget {
|
||||
@override
|
||||
_CodeEditor1State createState() => _CodeEditor1State();
|
||||
}
|
||||
|
||||
class _CodeEditor1State extends State<CodeEditor1> {
|
||||
CodeController? _codeController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final source = "void main() {\n print(\"Hello, world!\");\n}";
|
||||
// Instantiate the CodeController
|
||||
_codeController = CodeController(
|
||||
text: source,
|
||||
language: dart,
|
||||
theme: monokaiSublimeTheme,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_codeController?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CodeField(
|
||||
controller: _codeController!,
|
||||
textStyle: TextStyle(fontFamily: 'SourceCode'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Custom map example
|
||||
*/
|
||||
|
||||
class CodeEditor2 extends StatefulWidget {
|
||||
@override
|
||||
_CodeEditor2State createState() => _CodeEditor2State();
|
||||
}
|
||||
|
||||
class _CodeEditor2State extends State<CodeEditor2> {
|
||||
CodeController? _codeController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final source = "void main() {\n print(\"Hello, world!\");\n}";
|
||||
// Instantiate the CodeController
|
||||
_codeController = CodeController(
|
||||
text: source,
|
||||
language: dart,
|
||||
theme: monokaiSublimeTheme,
|
||||
stringMap: {
|
||||
"Hello": TextStyle(fontWeight: FontWeight.bold, color: Colors.red),
|
||||
"world": TextStyle(fontStyle: FontStyle.italic, color: Colors.green),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_codeController?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CodeField(
|
||||
controller: _codeController!,
|
||||
textStyle: TextStyle(fontFamily: 'SourceCode'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Custom patterns
|
||||
*/
|
||||
|
||||
class CodeEditor3 extends StatefulWidget {
|
||||
@override
|
||||
_CodeEditor3State createState() => _CodeEditor3State();
|
||||
}
|
||||
|
||||
class _CodeEditor3State extends State<CodeEditor3> {
|
||||
CodeController? _codeController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final source = "void main() {\n print(\"#Hello, #world!\");\n}";
|
||||
// Instantiate the CodeController
|
||||
_codeController = CodeController(
|
||||
text: source,
|
||||
language: dart,
|
||||
theme: monokaiSublimeTheme,
|
||||
patternMap: {
|
||||
r"\B#[a-zA-Z0-9]+\b":
|
||||
TextStyle(fontWeight: FontWeight.bold, color: Colors.purpleAccent),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_codeController?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CodeField(
|
||||
controller: _codeController!,
|
||||
textStyle: TextStyle(fontFamily: 'SourceCode'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Custom map
|
||||
*/
|
||||
|
||||
class CodeEditor4 extends StatefulWidget {
|
||||
@override
|
||||
_CodeEditor4State createState() => _CodeEditor4State();
|
||||
}
|
||||
|
||||
class _CodeEditor4State extends State<CodeEditor4> {
|
||||
CodeController? _codeController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final source = "void main() {\n print(\"#Hello, #world!\");\n}";
|
||||
// Instantiate the CodeController
|
||||
_codeController = CodeController(
|
||||
text: source,
|
||||
patternMap: {
|
||||
r'".*"': TextStyle(color: Colors.yellow),
|
||||
r'[a-zA-Z0-9]+\(.*\)': TextStyle(color: Colors.green),
|
||||
},
|
||||
stringMap: {
|
||||
"void": TextStyle(fontWeight: FontWeight.bold, color: Colors.red),
|
||||
"print": TextStyle(fontWeight: FontWeight.bold, color: Colors.blue),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_codeController?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CodeField(
|
||||
controller: _codeController!,
|
||||
textStyle: TextStyle(
|
||||
fontFamily: 'SourceCode',
|
||||
// color: Colors.grey.shade100,
|
||||
),
|
||||
lineNumberStyle: LineNumberStyle(
|
||||
textStyle: TextStyle(
|
||||
// color: Colors.grey.shade500,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Android screen
|
||||
*/
|
||||
|
||||
class CodeEditor5 extends StatefulWidget {
|
||||
@override
|
||||
_CodeEditor5State createState() => _CodeEditor5State();
|
||||
}
|
||||
|
||||
class _CodeEditor5State extends State<CodeEditor5> {
|
||||
CodeController? _codeController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final source = """// An expensive but pretty
|
||||
// recursive implementation
|
||||
int fibonacci(int n) {
|
||||
if (n <= 1) return n;
|
||||
return fibonacci(n - 1)
|
||||
+ fibonacci(n - 2);
|
||||
}
|
||||
|
||||
void main() {
|
||||
print("Fibonacci sequence:");
|
||||
for (var n = 0; n < 10; n++)
|
||||
print(fibonacci(n));
|
||||
}
|
||||
""";
|
||||
// Instantiate the CodeController
|
||||
_codeController = CodeController(
|
||||
text: source,
|
||||
language: dart,
|
||||
theme: a11yDarkTheme,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_codeController?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CodeField(
|
||||
controller: _codeController!,
|
||||
textStyle: TextStyle(fontFamily: 'SourceCode'),
|
||||
expands: true,
|
||||
);
|
||||
}
|
||||
}
|
||||