├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .prettierignore ├── .prettierrc ├── .vscode ├── launch.json └── settings.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── images ├── html-1.jpg ├── html-2.jpg ├── html-3.jpg ├── html-4.jpg ├── js-1.jpg ├── js-2.jpg ├── js-3.jpg ├── js-4.jpg ├── night-wolf-icon.png ├── pug-1.jpg ├── pug-2.jpg ├── pug-3.jpg ├── pug-4.jpg ├── sass-1.jpg ├── sass-2.jpg ├── sass-3.jpg ├── sass-4.jpg ├── vue-1.jpg ├── vue-2.jpg ├── vue-3.jpg └── vue-4.jpg ├── package-lock.json ├── package.json ├── source ├── colors │ └── dark-colors.js ├── dark.js └── variants │ └── dark │ ├── black.js │ ├── dark-blue.js │ ├── dark-gray.js │ └── gray.js ├── tests ├── .vscode │ └── settings.json ├── ChangeLog ├── Makefile ├── Makefile.am ├── README ├── file.Rnw ├── file.abnf ├── file.asp ├── file.bib ├── file.blade.php ├── file.c ├── file.cc ├── file.cg ├── file.cmake ├── file.cob ├── file.coffee ├── file.cs ├── file.css ├── file.csv ├── file.cu ├── file.dart ├── file.desktop ├── file.diff ├── file.dtd ├── file.dtl ├── file.exs ├── file.f ├── file.fcl ├── file.frt ├── file.fs ├── file.g ├── file.gdb ├── file.glslf ├── file.go ├── file.groovy ├── file.h ├── file.html ├── file.hx ├── file.ijm ├── file.impl ├── file.ini ├── file.java ├── file.js ├── file.json ├── file.jsx ├── file.la ├── file.less ├── file.ll ├── file.logcat ├── file.m ├── file.m4 ├── file.md ├── file.ml ├── file.octave ├── file.ooc ├── file.pc ├── file.php ├── file.pig ├── file.pl ├── file.po ├── file.prg ├── file.prolog ├── file.pug ├── file.py ├── file.rq ├── file.rs ├── file.rst ├── file.sass ├── file.sci ├── file.scss ├── file.sh ├── file.spec ├── file.sql ├── file.svelte ├── file.svh ├── file.t2t ├── file.tera ├── file.testv1 ├── file.tex ├── file.texi ├── file.toml ├── file.ts ├── file.tsx ├── file.vue ├── file.xml ├── file.y ├── gitConflict.vue ├── gtkrc ├── laravel.php ├── meson.build ├── react.js ├── test.sql ├── vue.vue ├── vue3.vue └── vue3B.vue ├── theme-compiler.js └── themes └── .gitkeep /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Please make sure you're using the latest version of the plugin before submitting an issue** 8 | 9 | **Screenshots** 10 | If applicable, add screenshots to help explain your problem, it helps us debug faster. 11 | 12 | If you are submitting a bug report in a language not currently in demo folder, a PR to this folder with the language helps us track it down. 13 | 14 | Thanks! 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Describe the solution you'd like** 8 | A clear and concise description of what you want to happen. 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | If so, a clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | design/ 3 | themes/* 4 | !themes/.gitkeep 5 | 6 | # ========================= 7 | # Operating System Files 8 | # ========================= 9 | 10 | # OSX 11 | # ========================= 12 | 13 | .DS_Store 14 | .AppleDouble 15 | .LSOverride 16 | 17 | # Thumbnails 18 | 19 | # Files that might appear in the root of a volume 20 | .DocumentRevisions-V100 21 | .fseventsd 22 | .Spotlight-V100 23 | .TemporaryItems 24 | .Trashes 25 | .VolumeIcon.icns 26 | 27 | # Directories potentially created on remote AFP share 28 | .AppleDB 29 | .AppleDesktop 30 | Network Trash Folder 31 | Temporary Items 32 | .apdisk 33 | 34 | # Windows 35 | # ========================= 36 | 37 | # Windows image file caches 38 | Thumbs.db 39 | ehthumbs.db 40 | 41 | # Folder config file 42 | Desktop.ini 43 | 44 | # Recycle Bin used on file shares 45 | $RECYCLE.BIN/ 46 | 47 | # Windows Installer files 48 | *.cab 49 | *.msi 50 | *.msm 51 | *.msp 52 | 53 | # Windows shortcuts 54 | *.lnk 55 | *.vsix 56 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | *.log* 3 | themes/ 4 | tests/ 5 | source/colors/ -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "trailingComma": "all", 4 | "singleQuote": true, 5 | "printWidth": 90 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "runtimeExecutable": "${execPath}", 13 | "args": [ 14 | "--extensionDevelopmentPath=${workspaceFolder}" 15 | ] 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "git-blame.gitWebUrl": "" 3 | } 4 | -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | **/*.js 2 | source/** 3 | tests/** 4 | design/** 5 | .github 6 | themes/.gitkeep 7 | .gitignore 8 | .vscode 9 | .prettierignore 10 | images/** 11 | !images/night-wolf-icon.png 12 | !LICENSE -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "night-wolf" extension are be documented in this file. 4 | 5 | ## [2.0.0] - 04-29-2025 6 | ### Added 7 | - Overhaul of all the theme scopes, improoving the experience accross all languages 8 | 9 | 10 | ## [1.13.1] - 04-23-2025 11 | ### Fixed 12 | - Improoved support for scss and sass 13 | - Removed the semanticTokenColors configuration where the classes and function declarations where set as bold 14 | - Better support for inline SQL in GO files, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/48) by [coscoaj1](https://github.com/coscoaj1) 15 | 16 | ## [1.13.0] - 11-09-2023 17 | ### Fixed 18 | - Better support for SQL, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/46) by [marcosvnmelo](https://github.com/marcosvnmelo) 19 | - Improoved support for Typescript 20 | 21 | 22 | ## [1.12.0] - 03-19-2023 23 | 24 | ### Added 25 | - Functions & Classes colors for golang added. 26 | - Vue camelCase components in template colors added. 27 | - Semantic Highlighting support, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/36) by [wtho](https://github.com/wtho). 28 | 29 | ### Changed 30 | - Engines supported updated (1.76.2). 31 | - Prettier updated to the latest version (2.8.4). 32 | 33 | ### Fixed 34 | - Inline diff coloring issue fixed, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/33) by [Avivhdr](https://github.com/Avivhdr). 35 | - Rulers color fixed, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/43) by [landure](https://github.com/landure). 36 | - Status bar items colored for danger and warning states. 37 | - Status bar items improve coloring for debugging state. 38 | - Js Async Await keywords colors more consistent. 39 | - Js loops kewords colors more consistent. 40 | - General coloring fixes. 41 | 42 | 43 | ## [1.11.4] - 05-29-2022 44 | 45 | ### Fixed 46 | 47 | - better Vue 3 and Typescript support 48 | 49 | ## [1.11.3] - 05-14-2022 50 | 51 | ### Fixed 52 | 53 | - better svelte support 54 | 55 | ## [1.11.2] - 04-06-2022 56 | 57 | ### Fixed 58 | 59 | - immprovements in javascript and typescript support in vue.js 60 | 61 | ## [1.11.1] - 04-05-2022 62 | 63 | ### Added 64 | 65 | - better javascript and typescript support 66 | 67 | ## [1.11.0] - 04-04-2022 68 | 69 | ### Fixed 70 | 71 | - Some coloring inconsistencies between javascript and typescript 72 | - Camelcase HTML tags in Vue.js not working 73 | - Color customizations changes not taking effect, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/34) by [chalop](https://github.com/chalop). 74 | 75 | ## [1.10.0] - 08-16-2021 76 | 77 | ### Added 78 | 79 | - Added chroma.js replacing Color.js due to better implementation of hex coloring 80 | 81 | ### Fixed 82 | 83 | - Selected words contrast being too low., [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/32) by [grindarius](https://github.com/grindarius). 84 | 85 | ## [1.9.1] - 07-18-2021 86 | 87 | ### Added 88 | 89 | - activity bar, active contrast 90 | 91 | ### Fixed 92 | 93 | - More contract on selected text?, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/31) by [WindSoilder](https://github.com/WindSoilder). 94 | 95 | --- 96 | ## [1.9.0] - 07-03-2021 97 | 98 | ### Added 99 | 100 | - better support for rust 101 | - bunch of new color configurations 102 | 103 | ### Fixed 104 | 105 | - Better support for rust-lang keyword?, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/30) by [WindSoilder](https://github.com/WindSoilder). 106 | - The background of editorGroupHeader is red, which bugging me, and different from the screen shot, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/29) by [WindSoilder](https://github.com/WindSoilder). 107 | 108 | --- 109 | 110 | ## [1.8.5] - 28-10-2020 111 | 112 | ### Fixed 113 | 114 | - .gitignored files and folder have the same color as the ones included in the repo, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/28) by [@abhijit-hota](https://github.com/abhijit-hota). 115 | 116 | --- 117 | 118 | ## [1.8.4] - 22-08-2020 119 | 120 | ### Fixed 121 | 122 | - Translucent tab when click and drag the tab doesn't work, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/27) by [@grindarius](https://github.com/grindarius). 123 | 124 | --- 125 | 126 | ## [1.8.3] - 31-03-2020 127 | 128 | ### Added 129 | 130 | - Added Prettier to the compiler project 131 | 132 | ### Fixed 133 | 134 | - Seeing italic fonts, even though I have selected the 'No italics' variant, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/24) by [@ijdickinson](https://github.com/ijdickinson). 135 | 136 | --- 137 | 138 | ## [1.8.2] - 11-07-2019 139 | 140 | ### Fixed 141 | 142 | - Background color overlapping texts, [issue](https://github.com/mao-santaella-rs/NightWolfTheme/issues/23) by [@silviolobo](https://github.com/silviolobo). 143 | 144 | --- 145 | 146 | ## [1.8.1] - 09-04-2019 147 | 148 | ### Added 149 | 150 | - basic support for laravel blade with [laravel-blade](https://marketplace.visualstudio.com/items?itemName=cjhowe7.laravel-blade) extension, [issue](https://github.com/maoma87/NightWolfTheme/issues/22) by [@quanKM](https://github.com/quanKM). 151 | 152 | ### Fixed 153 | 154 | - scss '&' selector, [issue](https://github.com/maoma87/NightWolfTheme/issues/22) by [@quanKM](https://github.com/quanKM). 155 | 156 | --- 157 | 158 | ## [1.8.0] - 08-10-2019 159 | 160 | ### Added 161 | 162 | - Theme gray version. thanks to [@chadhamre](https://github.com/chadhamre). 163 | 164 | ### Changed 165 | 166 | - Color for javascript classes is more related to the color of the functions. 167 | 168 | ### Fixed 169 | 170 | - C/C++ preprocessor directives should have a single color, [Issue](https://github.com/maoma87/NightWolfTheme/issues/19) by [@matter123](https://github.com/matter123). 171 | 172 | --- 173 | 174 | ## [1.7.3] - 07-13-2019 175 | 176 | ### Changed 177 | 178 | - update the images on README. 179 | 180 | --- 181 | 182 | ## [1.7.2] - 07-13-2019 183 | 184 | ### Fixed 185 | 186 | - PHP syntax aren't highlighted, [Issue](https://github.com/maoma87/NightWolfTheme/issues/17) by [@quanKM](https://github.com/quanKM). 187 | 188 | --- 189 | 190 | ## [1.7.1] - 07-11-2019 191 | 192 | ### Changed 193 | 194 | - Added more colors for black theme Interface. 195 | - Re-arrange colors in black theme Interface for better contrast and legibility. 196 | 197 | --- 198 | 199 | ## [1.6.0] - 07-10-2019 200 | 201 | ### Changed 202 | 203 | - Added more colors for Dark Gray Interface. 204 | - Re-arrange colors in Dark Gray Interface for better contrast and legibility. 205 | 206 | --- 207 | 208 | ## [1.5.1] - 06-30-2019 209 | 210 | ### Changed 211 | 212 | - Better CSS, SASS, SCSS colors. 213 | 214 | --- 215 | 216 | ## [1.5.0] - 06-27-2019 217 | 218 | ### Changed 219 | 220 | - Added more colors for Dark Blue Interface. 221 | - Re-arrange colors in Dark Blue Interface for better contrast and legibility. 222 | 223 | --- 224 | 225 | ## [1.4.0] - 06-17-2019 226 | 227 | ### Added 228 | 229 | - No italic versions added. 230 | 231 | --- 232 | 233 | ## [1.3.1] - 06-16-2019 234 | 235 | ### Fixed 236 | 237 | - Set Dark blue version as default. 238 | 239 | --- 240 | 241 | ## [1.3.0] - 06-16-2019 242 | 243 | ### Added 244 | 245 | - Theme black version. 246 | 247 | ### Changed 248 | 249 | - Git Diff editor colors. 250 | - Git merge conflicts colors. 251 | - List/Tree foreground color for selected item when list/tree is inactive. 252 | - RegExp color. 253 | - Colors for documentation in comments. 254 | 255 | ### Fixed 256 | 257 | - Deleted some redundant scopes. 258 | - better RegExp detection. 259 | 260 | --- 261 | 262 | ## [1.2.2] - 06-07-2019 263 | 264 | ### Fixed 265 | 266 | - better contrast for list focus item. 267 | 268 | --- 269 | 270 | ## [1.2.1] - 06-07-2019 271 | 272 | ### Fixed 273 | 274 | - better contrast for list hover item. 275 | - better contrast for dropdown hover item. 276 | 277 | --- 278 | 279 | ## [1.2.0] - 06-03-2019 280 | 281 | ### Added 282 | 283 | - Theme Dark Gray version. 284 | 285 | ### Fixed 286 | 287 | - Some colors in c#, go, markdown and ts. 288 | 289 | --- 290 | 291 | ## [1.1.1] - 05-28-2019 292 | 293 | ### Fixed 294 | 295 | - Scrollbar non intentional border color. 296 | 297 | --- 298 | 299 | ## [1.1.0] - 05-26-2019 300 | 301 | ### Fixed 302 | 303 | - Scrollbar decorations overlap, [Issue](https://github.com/maoma87/NightWolfTheme/issues/4) by [@usernamehw](https://github.com/usernamehw). 304 | - Scrollbar warning feels out of place, [Issue](https://github.com/maoma87/NightWolfTheme/issues/5) by [@usernamehw](https://github.com/usernamehw). 305 | 306 | --- 307 | 308 | ## [1.0.1] - 05-26-2019 309 | 310 | ### Fixed 311 | 312 | - jsx curly brackets {} color fixed. 313 | 314 | --- 315 | 316 | ## [1.0.0] - 05-25-2019 317 | 318 | - Initial release. 319 | 320 | --- 321 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Mauricio Santaella Ochoa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Night Wolf 🐺 2 | [![ver](https://vsmarketplacebadges.dev/version-short/MaoSantaella.night-wolf.svg?label=Night-Wolf&colorA=1A3144&colorB=5FB7DA)](https://marketplace.visualstudio.com/items?itemName=MaoSantaella.night-wolf) 3 | ![installs](https://vsmarketplacebadges.dev/installs/MaoSantaella.night-wolf.svg?label=Installs&colorA=1A3144&colorB=5FB7DA) 4 | ![downloads](https://vsmarketplacebadges.dev/downloads/MaoSantaella.night-wolf.svg?label=Downloads&colorA=1A3144&colorB=5FB7DA) 5 | ![rating](https://vsmarketplacebadges.dev/rating-short/MaoSantaella.night-wolf.svg?label=Rating&colorA=1A3144&colorB=5FB7DA) 6 | ![rating](https://vsmarketplacebadges.dev/trending-weekly/MaoSantaella.night-wolf.svg?label=Trend-W&colorA=1A3144&colorB=5FB7DA) 7 | ![rating](https://vsmarketplacebadges.dev/trending-monthly/MaoSantaella.night-wolf.svg?label=Trend-M&colorA=1A3144&colorB=5FB7DA) 8 | 9 | A Visual Studio Code theme based on the Sarah Drasner's [Night owl theme](https://marketplace.visualstudio.com/items?itemName=sdras.night-owl). 10 | 11 | *This was based in my own personal taste. 12 | 13 | ## Javascript 14 | ![js1](images/js-1.jpg) 15 | ![js2](images/js-2.jpg) 16 | ![js3](images/js-3.jpg) 17 | ![js4](images/js-4.jpg) 18 | 19 | ## Vue 20 | ![vue1](images/vue-1.jpg) 21 | ![vue2](images/vue-2.jpg) 22 | ![vue3](images/vue-3.jpg) 23 | ![vue4](images/vue-4.jpg) 24 | 25 | ## Sass 26 | ![sass1](images/sass-1.jpg) 27 | ![sass2](images/sass-2.jpg) 28 | ![sass3](images/sass-3.jpg) 29 | ![sass4](images/sass-4.jpg) 30 | 31 | ## Pug 32 | ![pug1](images/pug-1.jpg) 33 | ![pug2](images/pug-2.jpg) 34 | ![pug3](images/pug-3.jpg) 35 | ![pug4](images/pug-4.jpg) 36 | 37 | ## Html 38 | ![html1](images/html-1.jpg) 39 | ![html2](images/html-2.jpg) 40 | ![html3](images/html-3.jpg) 41 | ![html4](images/html-4.jpg) 42 | 43 | *big images to preserve details 44 | 45 | # Installation 46 | 47 | 1. Install [Visual Studio Code](https://code.visualstudio.com/) 48 | 2. Launch Visual Studio Code 49 | 3. Choose **Extensions** from menu 50 | 4. Search for `night-wolf` 51 | 5. Click **Install** to install it 52 | 6. Click **Reload** to reload VsCode 53 | 7. From the menu bar click: Code > Preferences > Color Theme > **Night Wolf** 54 | 55 | # Misc 56 | 57 | This is also my first foray into creating a theme, so if you see something amiss, please feel free to [file an issue](https://github.com/maoma87/NightWolfTheme/issues)! I'm sure there are things I missed. 58 | 59 | Any relevant changes for each version are documented in the changelog. Please update and check the changelog before filing any issues, as they may have already been taken care of. 60 | -------------------------------------------------------------------------------- /images/html-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/html-1.jpg -------------------------------------------------------------------------------- /images/html-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/html-2.jpg -------------------------------------------------------------------------------- /images/html-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/html-3.jpg -------------------------------------------------------------------------------- /images/html-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/html-4.jpg -------------------------------------------------------------------------------- /images/js-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/js-1.jpg -------------------------------------------------------------------------------- /images/js-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/js-2.jpg -------------------------------------------------------------------------------- /images/js-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/js-3.jpg -------------------------------------------------------------------------------- /images/js-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/js-4.jpg -------------------------------------------------------------------------------- /images/night-wolf-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/night-wolf-icon.png -------------------------------------------------------------------------------- /images/pug-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/pug-1.jpg -------------------------------------------------------------------------------- /images/pug-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/pug-2.jpg -------------------------------------------------------------------------------- /images/pug-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/pug-3.jpg -------------------------------------------------------------------------------- /images/pug-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/pug-4.jpg -------------------------------------------------------------------------------- /images/sass-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/sass-1.jpg -------------------------------------------------------------------------------- /images/sass-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/sass-2.jpg -------------------------------------------------------------------------------- /images/sass-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/sass-3.jpg -------------------------------------------------------------------------------- /images/sass-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/sass-4.jpg -------------------------------------------------------------------------------- /images/vue-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/vue-1.jpg -------------------------------------------------------------------------------- /images/vue-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/vue-2.jpg -------------------------------------------------------------------------------- /images/vue-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/vue-3.jpg -------------------------------------------------------------------------------- /images/vue-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/images/vue-4.jpg -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "night-wolf", 3 | "version": "2.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "night-wolf", 9 | "version": "2.0.0", 10 | "license": "SEE LICENSE IN THE LICENSE FILE", 11 | "devDependencies": { 12 | "chroma-js": "^3.1.2", 13 | "prettier": "^3.5.3" 14 | }, 15 | "engines": { 16 | "vscode": "^1.76.2" 17 | } 18 | }, 19 | "node_modules/chroma-js": { 20 | "version": "3.1.2", 21 | "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-3.1.2.tgz", 22 | "integrity": "sha512-IJnETTalXbsLx1eKEgx19d5L6SRM7cH4vINw/99p/M11HCuXGRWL+6YmCm7FWFGIo6dtWuQoQi1dc5yQ7ESIHg==", 23 | "dev": true, 24 | "license": "(BSD-3-Clause AND Apache-2.0)" 25 | }, 26 | "node_modules/prettier": { 27 | "version": "3.5.3", 28 | "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz", 29 | "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==", 30 | "dev": true, 31 | "license": "MIT", 32 | "bin": { 33 | "prettier": "bin/prettier.cjs" 34 | }, 35 | "engines": { 36 | "node": ">=14" 37 | }, 38 | "funding": { 39 | "url": "https://github.com/prettier/prettier?sponsor=1" 40 | } 41 | } 42 | }, 43 | "dependencies": { 44 | "chroma-js": { 45 | "version": "3.1.2", 46 | "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-3.1.2.tgz", 47 | "integrity": "sha512-IJnETTalXbsLx1eKEgx19d5L6SRM7cH4vINw/99p/M11HCuXGRWL+6YmCm7FWFGIo6dtWuQoQi1dc5yQ7ESIHg==", 48 | "dev": true 49 | }, 50 | "prettier": { 51 | "version": "3.5.3", 52 | "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz", 53 | "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==", 54 | "dev": true 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "night-wolf", 3 | "displayName": "Night Wolf", 4 | "description": "Night Wolf is a dark theme based on Night Owl", 5 | "version": "2.0.0", 6 | "publisher": "MaoSantaella", 7 | "type": "module", 8 | "license": "SEE LICENSE IN THE LICENSE FILE", 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/maoma87/NightWolfTheme" 12 | }, 13 | "bugs": { 14 | "url": "https://github.com/maoma87/NightWolfTheme/issues", 15 | "email": "mauriciosantaella@outlook.com" 16 | }, 17 | "engines": { 18 | "vscode": "^1.76.2" 19 | }, 20 | "contributes": { 21 | "themes": [ 22 | { 23 | "label": "Night Wolf (dark blue)", 24 | "uiTheme": "vs-dark", 25 | "path": "./themes/night-wolf-dark-blue.json" 26 | }, 27 | { 28 | "label": "Night Wolf (dark blue) (No Italics)", 29 | "uiTheme": "vs-dark", 30 | "path": "./themes/night-wolf-dark-blue-noitalics.json" 31 | }, 32 | { 33 | "label": "Night Wolf (dark gray)", 34 | "uiTheme": "vs-dark", 35 | "path": "./themes/night-wolf-dark-gray.json" 36 | }, 37 | { 38 | "label": "Night Wolf (dark gray) (No Italics)", 39 | "uiTheme": "vs-dark", 40 | "path": "./themes/night-wolf-dark-gray-noitalics.json" 41 | }, 42 | { 43 | "label": "Night Wolf (gray)", 44 | "uiTheme": "vs-dark", 45 | "path": "./themes/night-wolf-gray.json" 46 | }, 47 | { 48 | "label": "Night Wolf (gray) (No Italics)", 49 | "uiTheme": "vs-dark", 50 | "path": "./themes/night-wolf-gray-noitalics.json" 51 | }, 52 | { 53 | "label": "Night Wolf (black)", 54 | "uiTheme": "vs-dark", 55 | "path": "./themes/night-wolf-black.json" 56 | }, 57 | { 58 | "label": "Night Wolf (black) (No Italics)", 59 | "uiTheme": "vs-dark", 60 | "path": "./themes/night-wolf-black-noitalics.json" 61 | } 62 | ] 63 | }, 64 | "scripts": { 65 | "dev": "node theme-compiler dev", 66 | "prod": "node theme-compiler prod", 67 | "pub-major": "vsce publish major", 68 | "pub-minor": "vsce publish minor", 69 | "pub-patch": "vsce publish patch", 70 | "vscode:prepublish": "node theme-compiler prod" 71 | }, 72 | "devDependencies": { 73 | "chroma-js": "^3.1.2", 74 | "prettier": "^3.5.3" 75 | }, 76 | "keywords": [ 77 | "Theme", 78 | "Dark Theme", 79 | "Night wolf", 80 | "Night Theme" 81 | ], 82 | "categories": [ 83 | "Themes" 84 | ], 85 | "galleryBanner": { 86 | "color": "#101E2C", 87 | "theme": "dark" 88 | }, 89 | "icon": "images/night-wolf-icon.png" 90 | } 91 | -------------------------------------------------------------------------------- /source/colors/dark-colors.js: -------------------------------------------------------------------------------- 1 | import chroma from 'chroma-js' 2 | 3 | const colors = {} 4 | 5 | //basic colors 6 | colors.white = chroma(255, 255, 255) 7 | colors.black = chroma(0, 0, 0) 8 | 9 | // Syntax Colors 10 | colors.syntaxRed = chroma(255, 120, 120) // rgb(255, 120, 120) 11 | colors.syntaxRedIntense = chroma(255, 80, 180) // rgb(255,80,120) 12 | colors.syntaxOrange = chroma(255, 180, 130) // rgb(255, 180, 130) 13 | colors.syntaxDarkOrange = chroma(255, 153, 102) // rgb(255 153 102) 14 | colors.syntaxYellow = chroma(255, 220, 150) // rgb(255, 220, 150) 15 | colors.syntaxBeige = chroma(219, 212, 186) // rgb(219, 212, 186) 16 | colors.syntaxGreen = chroma(170, 230, 130) // rgb(170, 230, 130) 17 | colors.syntaxCyan = chroma(0, 220, 220) // rgb(0, 220, 220) 18 | colors.syntaxLightBlue = chroma(134, 224, 244) // rgb(134 224 244) 19 | colors.syntaxBlue = chroma(0, 177, 255) // rgb(0, 177, 255) 20 | colors.syntaxViolet = chroma(150, 150, 255) // rgb(150, 150, 255) 21 | colors.syntaxPurple = chroma(220, 140, 255) // rgb(220, 140, 255) 22 | colors.syntaxMagenta = chroma(255, 80, 255) // rgb(255, 80, 255) 23 | 24 | colors.contrast = colors.syntaxMagenta 25 | colors.contrastLight = chroma(255, 190, 255) // rgb(255, 190, 255) 26 | colors.contrastDark = chroma(150, 0, 150) // rgb(150, 0, 150) 27 | 28 | colors.comment = chroma(100, 120, 130) // rgb(100, 120, 130) 29 | 30 | // STATES COLORS 31 | colors.infoDark = chroma(40, 72, 100) // rgb(40, 72, 100) 32 | colors.info = chroma(100, 180, 250) // rgb(100, 180, 250) 33 | colors.infoLight = chroma(156, 217, 255) // rgb(156, 217, 255) 34 | 35 | colors.successDark = chroma(44, 72, 32) // rgb(44, 72, 32) 36 | colors.success = chroma(110, 180, 80) // rgb(110, 180, 80) 37 | colors.successLight = chroma(161, 216, 132) // rgb(161, 216, 132) 38 | 39 | colors.warningDark = chroma(102, 80, 16) // rgb(102, 80, 16) 40 | colors.warning = chroma(255, 200, 40) // rgb(255, 200, 40) 41 | colors.warningLight = chroma(255, 227, 156) // rgb(255, 227, 156) 42 | 43 | colors.dangerDark = chroma(71, 32, 32) // rgb(71, 32, 32) 44 | colors.danger = chroma(240, 80, 80) // rgb(240, 80, 80) 45 | colors.dangerLight = chroma(216, 130, 130) // rgb(216, 130, 130) 46 | 47 | //Test colors 48 | colors.testA = chroma(255, 255, 0) // rgb(255, 255, 0) 49 | colors.testB = chroma(0, 255, 0) // rgb(0, 255, 0) 50 | colors.testC = chroma(255, 100, 0) // rgb(255, 100, 0) 51 | 52 | colors.redPastel = chroma(48,118,174) // rgb(248 118 174) 53 | colors.pinkPastel = chroma(252,154,193) // rgb(252 154 193) 54 | colors.purplePastel = chroma(182,147,223) // rgb(182 147 223) 55 | colors.yellowPastel = chroma(243,251,151) // rgb(243 251 151) 56 | colors.greenPastel = chroma(4,250,210) // rgb(4 250 210) 57 | 58 | // SYNTAX COLORS 59 | colors.text = colors.white 60 | colors.variable = colors.syntaxYellow 61 | colors.variableProperty = colors.text 62 | colors.contrastText = colors.syntaxRed 63 | colors.variableInstance = colors.syntaxOrange 64 | colors.specialWordA = colors.syntaxBlue 65 | colors.specialWordB = colors.syntaxViolet 66 | colors.specialWordC = colors.syntaxPurple 67 | colors.functionName = colors.syntaxCyan 68 | colors.string = colors.syntaxGreen 69 | colors.operator = colors.contrastText 70 | colors.number = colors.syntaxOrange 71 | colors.boolean = colors.contrastText 72 | colors.nullUnd = colors.contrastText 73 | colors.punctuation = colors.text 74 | colors.deprecated = colors.danger 75 | 76 | // Markup 77 | colors.htmlTag = colors.contrastText 78 | colors.metaTag = colors.text 79 | colors.tagAttribute = colors.specialWordB 80 | colors.pugClass = colors.variable 81 | 82 | // Stylesheets 83 | colors.cssAttribute = colors.syntaxGreen 84 | colors.cssValue = colors.syntaxOrange 85 | colors.cssTag = colors.syntaxRed 86 | colors.cssClass = colors.syntaxYellow 87 | colors.cssProperty = colors.syntaxCyan 88 | colors.cssUnits = colors.number 89 | colors.cssSpecialWord = colors.syntaxLightBlue 90 | colors.cssPseudoClass = colors.syntaxPurple 91 | colors.sassFunction = colors.syntaxBlue 92 | colors.sassInterpolation = colors.syntaxRed 93 | 94 | export default colors 95 | -------------------------------------------------------------------------------- /source/variants/dark/black.js: -------------------------------------------------------------------------------- 1 | import chroma from 'chroma-js' 2 | 3 | export default function (colors) { 4 | // THEME COLORS 5 | colors.principal = colors.black 6 | colors.principal_0 = chroma(20, 20, 20) // rgb(20, 20, 20) 7 | colors.principal_1 = chroma(40, 40, 40) // rgb(40, 40, 40) 8 | colors.principal_2 = chroma(60, 60, 60) // rgb(60, 60, 60) 9 | colors.principal_3 = chroma(80, 80, 80) // rgb(80, 80, 80) 10 | colors.principal_4 = chroma(120, 120, 120) // rgb(120, 120, 120) 11 | colors.principal_5 = chroma(150, 150, 150) // rgb(150, 150, 150) 12 | 13 | colors.text = chroma(200, 200, 200) // rgb(200, 200, 200) 14 | 15 | colors.gitInsertedBg = chroma(153, 183, 109).alpha(0.15) // rgba(153, 183, 109,.15) 16 | colors.gitRemovedBg = chroma(239, 83, 80).alpha(0.15) // rgba(239, 83, 80,.15) 17 | colors.gitIgnoreExplorer = colors.principal_0.brighten(1.5) 18 | 19 | // INTERFACE COLORS 20 | colors.interBackground = colors.principal 21 | colors.interBorder = colors.principal_1 22 | colors.notificationBadge = colors.white 23 | 24 | // INTERFACE SELECTION 25 | colors.selection_0 = colors.principal_5.alpha(0.1) 26 | colors.selection_1 = colors.principal_5.alpha(0.2) 27 | colors.selection_2 = colors.principal_5.alpha(0.3) 28 | colors.selection_3 = colors.principal_5.alpha(0.4) 29 | colors.selection_4 = colors.principal_5.alpha(0.35) 30 | 31 | return colors 32 | } 33 | -------------------------------------------------------------------------------- /source/variants/dark/dark-blue.js: -------------------------------------------------------------------------------- 1 | import chroma from 'chroma-js' 2 | 3 | export default function (colors) { 4 | // THEME COLORS 5 | colors.principal = chroma(16, 30, 44) // rgb(16, 30, 44) 6 | colors.principal_0 = chroma(20, 40, 60) // rgb(20, 40, 60) 7 | colors.principal_1 = chroma(27, 50, 74) // rgb(27, 50, 74) 8 | colors.principal_2 = chroma(30, 70, 103) // rgb(30, 70, 103) 9 | colors.principal_3 = chroma(48, 90, 132) // rgb(48, 90, 132) 10 | colors.principal_4 = chroma(95, 130, 165) // rgb(95, 130, 165) 11 | colors.principal_5 = chroma(123, 165, 207) // rgb(123, 165, 207) 12 | 13 | colors.text = chroma(189, 210, 231) // rgb(189, 210, 231) 14 | 15 | colors.gitInsertedBg = chroma(153, 183, 109).alpha(0.15) // rgba(153, 183, 109,.15) 16 | colors.gitRemovedBg = chroma(239, 83, 80).alpha(0.15) // rgba(239, 83, 80,.15) 17 | colors.gitIgnoreExplorer = colors.principal.brighten(1.5) 18 | 19 | // INTERFACE COLORS 20 | colors.interBackground = colors.principal 21 | colors.interBorder = colors.principal_1 22 | colors.notificationBadge = colors.infoLight 23 | 24 | // INTERFACE SELECTION 25 | colors.selection_0 = colors.principal_5.alpha(0.1) 26 | colors.selection_1 = colors.principal_5.alpha(0.2) 27 | colors.selection_2 = colors.principal_5.alpha(0.3) 28 | colors.selection_3 = colors.principal_5.alpha(0.4) 29 | colors.selection_4 = colors.principal_2.alpha(0.6) 30 | 31 | return colors 32 | } 33 | -------------------------------------------------------------------------------- /source/variants/dark/dark-gray.js: -------------------------------------------------------------------------------- 1 | import chroma from 'chroma-js' 2 | 3 | export default function (colors) { 4 | // THEME COLORS 5 | colors.principal = chroma(27, 27, 27) // rgb(27, 27, 27) 6 | colors.principal_0 = chroma(36, 36, 36) // rgb(36, 36, 36) 7 | colors.principal_1 = chroma(46, 46, 46) // rgb(46, 46, 46) 8 | colors.principal_2 = chroma(61, 61, 61) // rgb(61, 61, 61) 9 | colors.principal_3 = chroma(82, 82, 82) // rgb(82, 82, 82) 10 | colors.principal_4 = chroma(124, 124, 124) // rgb(124, 124, 124) 11 | colors.principal_5 = chroma(157, 157, 157) // rgb(157, 157, 157) 12 | 13 | colors.text = chroma(206, 206, 206) // rgb(206, 206, 206) 14 | 15 | colors.gitInsertedBg = chroma(153, 183, 109).alpha(0.15) // rgba(153, 183, 109,.15) 16 | colors.gitRemovedBg = chroma(239, 83, 80).alpha(0.15) // rgba(239, 83, 80,.15) 17 | colors.gitIgnoreExplorer = colors.principal.brighten(1.5) 18 | 19 | // INTERFACE COLORS 20 | colors.interBackground = colors.principal 21 | colors.interBorder = colors.principal_1 22 | colors.notificationBadge = colors.white 23 | 24 | // INTERFACE SELECTION 25 | colors.selection_0 = colors.principal_5.alpha(0.1) 26 | colors.selection_1 = colors.principal_5.alpha(0.2) 27 | colors.selection_2 = colors.principal_5.alpha(0.3) 28 | colors.selection_3 = colors.principal_5.alpha(0.4) 29 | colors.selection_4 = colors.principal_5.alpha(0.35) 30 | 31 | return colors 32 | } 33 | -------------------------------------------------------------------------------- /source/variants/dark/gray.js: -------------------------------------------------------------------------------- 1 | import chroma from 'chroma-js' 2 | 3 | export default function (colors) { 4 | // THEME COLORS 5 | colors.principal = chroma(37, 37, 37) // rgb(37, 37, 37) 6 | colors.principal_0 = chroma(45, 45, 45) // rgb(45, 45, 45) 7 | colors.principal_1 = chroma(55, 55, 55) // rgb(55, 55, 55) 8 | colors.principal_2 = chroma(69, 69, 69) // rgb(69, 69, 69) 9 | colors.principal_3 = chroma(89, 89, 89) // rgb(89, 89, 89) 10 | colors.principal_4 = chroma(117, 117, 117) // rgb(117, 117, 117) 11 | colors.principal_5 = chroma(155, 155, 155) // rgb(155, 155, 155) 12 | 13 | colors.text = chroma(206, 206, 206) // rgb(206, 206, 206) 14 | 15 | colors.gitInsertedBg = chroma(153, 183, 109).alpha(0.15) // rgba(153, 183, 109,.15) 16 | colors.gitRemovedBg = chroma(239, 83, 80).alpha(0.15) // rgba(239, 83, 80,.15) 17 | colors.gitIgnoreExplorer = colors.principal.brighten(1.5) 18 | 19 | // INTERFACE COLORS 20 | colors.interBackground = colors.principal 21 | colors.interBorder = colors.principal_1 22 | colors.notificationBadge = colors.white 23 | 24 | // INTERFACE SELECTION 25 | colors.selection_0 = colors.principal_5.alpha(0.1) 26 | colors.selection_1 = colors.principal_5.alpha(0.2) 27 | colors.selection_2 = colors.principal_5.alpha(0.3) 28 | colors.selection_3 = colors.principal_5.alpha(0.4) 29 | colors.selection_4 = colors.principal_5.alpha(0.35) 30 | 31 | return colors 32 | } 33 | -------------------------------------------------------------------------------- /tests/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "git-blame.gitWebUrl": "" 3 | } 4 | -------------------------------------------------------------------------------- /tests/ChangeLog: -------------------------------------------------------------------------------- 1 | = Release = 2 | 3 | 2006-12-10 Kristian Rietveld 4 | 5 | * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event): 6 | cancel editing (ie. don't accept changes) when the entry loses 7 | focus. (Fixes #164494, reported by Chris Rouch). 8 | 9 | 2006-12-10 Matthias Clasen 10 | 11 | * configure.in: Correct a misapplied patch. 12 | -------------------------------------------------------------------------------- /tests/Makefile: -------------------------------------------------------------------------------- 1 | all: foo bar 2 | foo: hello ; $(MAKE) bar 3 | bar: 4 | echo "Hello world!" 5 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST += README.W32 2 | 3 | if HAVE_DOXYGEN 4 | DOXYDIR = docs 5 | endif 6 | 7 | doc_DATA = AUTHORS ChangeLog COPYING INSTALL NEWS README 8 | 9 | bin_PROGRAMS = jupiter 10 | jupiter_SOURCES = main.c 11 | jupiter_CPPFLAGS = -I$(top_srcdir)/common 12 | jupiter_LDADD = ../common/libjupcommon.a 13 | 14 | check_SCRIPTS = greptest.sh 15 | TESTS = $(check_SCRIPTS) 16 | 17 | greptest.sh: 18 | echo './jupiter | grep "Hello from .*jupiter!"' > greptest.sh 19 | chmod +x greptest.sh 20 | 21 | CLEANFILES = greptest.sh 22 | -------------------------------------------------------------------------------- /tests/README: -------------------------------------------------------------------------------- 1 | This directory contains test files for the syntax highlighting. 2 | Open them to see if something broke. Kind of smoke test. 3 | 4 | If possible the file name should be "file.". 5 | But there are exceptions: ChangeLog, Makefile, Makefile.am, etc. 6 | -------------------------------------------------------------------------------- /tests/file.Rnw: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | \begin{document} 3 | Hi there! 4 | <>= 5 | # Say hello 6 | hello <- setClass("hello", slots = c(a="character", b="character")) 7 | sayHi <- hello(a="Hello", b="World") 8 | paste(sayHi@a, sayHi@b) 9 | rm(hello) 10 | 11 | hello <- list() 12 | hello <- sayHi@a 13 | @ 14 | Hi again! 15 | \end{document} 16 | -------------------------------------------------------------------------------- /tests/file.abnf: -------------------------------------------------------------------------------- 1 | ; An ABNF file. Here’s a whole-line comment. 2 | 3 | rule1 = rule2 / 4 | %b1010 / ; mid-rule comment 5 | %d100 6 | rule1 =/ %x20-25 / 7 | %x30.31 8 | 9 | rule2 = "some-string" / "a" ; here’s a comment at the end of a rule 10 | 11 | rule3=rule1 rule2 12 | 13 | rule4 = (rule3 rule1) / (rule1 *rule2) 14 | 15 | rule5 = 1*rule1 / 16 | *2rule2 / 17 | 1*3rule3 / 18 | 2rule1 / 19 | *1( rule4 rule3 ) 20 | -------------------------------------------------------------------------------- /tests/file.asp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <% 5 | dim d 6 | set d=Server.CreateObject("Scripting.Dictionary") 7 | d.Add "o", "Orange" 8 | d.Add "a", "Apple" 9 | if d.Exists("o")= true then 10 | Response.Write("Key exists.") 11 | else 12 | Response.Write("Key does not exist.") 13 | end if 14 | set d=nothing 15 | %> 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/file.bib: -------------------------------------------------------------------------------- 1 | %A .bib file might contain the following entry, which describes a mathematical handbook 2 | @Book{abramowitz+stegun, 3 | author = "Milton {Abramowitz} and Irene A. {Stegun}", 4 | title = "Handbook of Mathematical Functions with 5 | Formulas, Graphs, and Mathematical Tables", 6 | publisher = "Dover", 7 | year = 1964, 8 | address = "New York", 9 | edition = "ninth Dover printing, tenth GPO printing" 10 | } 11 | -------------------------------------------------------------------------------- /tests/file.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | App Name - @yield('title') 4 | 5 | 6 | @section('sidebar') 7 | This is the master sidebar. 8 | @show 9 | 10 |
11 | @yield('content') 12 |
13 | 14 | @extends('layouts.app') 15 | 16 | @section('title', 'Page Title') 17 | 18 | @section('sidebar') 19 | @parent 20 | 21 |

This is appended to the master sidebar.

22 | @endsection 23 | 24 | @section('content') 25 |

This is my body content.

26 | @endsection 27 | 28 | @yield('content', View::make('view.name')) 29 | 30 | 31 |
32 | {{ $slot }} 33 |
34 | 35 | @component('alert') 36 | Whoops! Something went wrong! 37 | @endcomponent 38 | 39 | @componentFirst(['custom.alert', 'alert']) 40 | Whoops! Something went wrong! 41 | @endcomponent 42 | 43 |
44 |
{{ $title }}
45 | 46 | {{ $slot }} 47 |
48 | 49 | @component('alert') 50 | @slot('title') 51 | Forbidden 52 | @endslot 53 | 54 | You are not allowed to access this resource! 55 | @endcomponent 56 | 57 | 58 | @if (count($records) === 1) 59 | I have one record! 60 | @elseif (count($records) > 1) 61 | I have multiple records! 62 | @else 63 | I don't have any records! 64 | @endif 65 | 66 | @unless (Auth::check()) 67 | You are not signed in. 68 | @endunless 69 | 70 | @isset($records) 71 | {{-- $records is defined and is not null... --}} 72 | @endisset 73 | 74 | @empty($records) 75 | {{-- $records is "empty"... --}} 76 | @endempty 77 | 78 | @auth 79 | {{-- The user is authenticated... --}} 80 | @endauth 81 | 82 | @guest 83 | {{-- The user is not authenticated... --}} 84 | @endguest 85 | 86 | @auth('admin') 87 | {{-- // The user is authenticated... --}} 88 | @endauth 89 | 90 | @guest('admin') 91 | {{-- // The user is not authenticated... --}} 92 | @endguest 93 | 94 | @hasSection('navigation') 95 |
96 | @yield('navigation') 97 |
98 | 99 |
100 | @endif 101 | 102 | @switch($i) 103 | @case(1) 104 | First case... 105 | @break 106 | 107 | @case(2) 108 | Second case... 109 | @break 110 | 111 | @default 112 | Default case... 113 | 114 | @endswitch 115 | 116 | @for ($i = 0; $i < 10; $i++) 117 | The current value is {{ $i }} 118 | @endfor 119 | 120 | @foreach ($users as $user) 121 |

This is user {{ $user->id }}

122 | @endforeach 123 | 124 | @forelse ($users as $user) 125 |
  • {{ $user->name }}
  • 126 | @empty 127 |

    No users

    128 | @endforelse 129 | 130 | @while (true) 131 |

    I'm looping forever.

    132 | @endwhile 133 | 134 | 135 | @foreach ($users as $user) 136 | @if ($user->type == 1) 137 | @continue 138 | @endif 139 | 140 |
  • {{ $user->name }}
  • 141 | 142 | @if ($user->number == 5) 143 | @break 144 | @endif 145 | @endforeach 146 | 147 | @push('scripts') 148 | 149 | @endpush 150 | 151 | 152 | format('m/d/Y H:i'); ?>"; 179 | }); 180 | } 181 | } 182 | ?> 183 | 184 | 4 | 5 | int main (void) 6 | { 7 | int a = 0x89; 8 | int b = 089; 9 | int c = 89.; 10 | int d = 'a'; 11 | printf ("Hello %s!\n", "world"); 12 | return 0; 13 | } 14 | 15 | 16 | 17 | 18 | /*! \file structcmd.h 19 | \brief A Documented file. 20 | 21 | Details. 22 | */ 23 | /*! \def MAX(a,b) 24 | \brief A macro that returns the maximum of \a a and \a b. 25 | 26 | Details. 27 | */ 28 | /*! \var typedef unsigned int UINT32 29 | \brief A type definition for a . 30 | 31 | Details. 32 | */ 33 | /*! \var int errno 34 | \brief Contains the last error code. 35 | \warning Not thread safe! 36 | */ 37 | /*! \fn int open(const char *pathname,int flags) 38 | \brief Opens a file descriptor. 39 | \param pathname The name of the descriptor. 40 | \param flags Opening flags. 41 | */ 42 | /*! \fn int close(int fd) 43 | \brief Closes the file descriptor \a fd. 44 | \param fd The descriptor to close. 45 | */ 46 | /*! \fn size_t write(int fd,const char *buf, size_t count) 47 | \brief Writes \a count bytes from \a buf to the filedescriptor \a fd. 48 | \param fd The descriptor to write to. 49 | \param buf The data buffer to write. 50 | \param count The number of bytes to write. 51 | */ 52 | /*! \fn int read(int fd,char *buf,size_t count) 53 | \brief Read bytes from a file descriptor. 54 | \param fd The descriptor to read from. 55 | \param buf The buffer to read into. 56 | \param count The number of bytes to read. 57 | */ 58 | #define MAX(a,b) (((a)>(b))?(a):(b)) 59 | typedef unsigned int UINT32; 60 | int errno; 61 | int open(const char *,int); 62 | int close(int); 63 | size_t write(int,const char *, size_t); 64 | int read(int,char *,size_t); -------------------------------------------------------------------------------- /tests/file.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class A : B { 4 | public: 5 | A(); 6 | private: 7 | foobar() const; 8 | }; 9 | 10 | //! A test class. 11 | /*! 12 | A more elaborate class description. 13 | */ 14 | class QTstyle_Test 15 | { 16 | public: 17 | //! An enum. 18 | /*! More detailed enum description. */ 19 | enum TEnum { 20 | TVal1, /*!< Enum value TVal1. */ 21 | TVal2, /*!< Enum value TVal2. */ 22 | TVal3 /*!< Enum value TVal3. */ 23 | } 24 | //! Enum pointer. 25 | /*! Details. */ 26 | *enumPtr, 27 | //! Enum variable. 28 | /*! Details. */ 29 | enumVar; 30 | 31 | //! A constructor. 32 | /*! 33 | A more elaborate description of the constructor. 34 | */ 35 | QTstyle_Test(); 36 | //! A destructor. 37 | /*! 38 | A more elaborate description of the destructor. 39 | */ 40 | ~QTstyle_Test(); 41 | 42 | //! A normal member taking two arguments and returning an integer value. 43 | /*! 44 | \param a an integer argument. 45 | \param s a constant character pointer. 46 | \return The test results 47 | \sa QTstyle_Test(), ~QTstyle_Test(), testMeToo() and publicVar() 48 | */ 49 | int testMe(int a,const char *s); 50 | 51 | //! A pure virtual member. 52 | /*! 53 | \sa testMe() 54 | \param c1 the first argument. 55 | \param c2 the second argument. 56 | */ 57 | virtual void testMeToo(char c1,char c2) = 0; 58 | 59 | //! A public variable. 60 | /*! 61 | Details. 62 | */ 63 | int publicVar; 64 | 65 | //! A function variable. 66 | /*! 67 | Details. 68 | */ 69 | int (*handler)(int a,int b); 70 | }; 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /tests/file.cg: -------------------------------------------------------------------------------- 1 | struct OurOutputType 2 | { 3 | float4 position : POSITION; 4 | float4 color : COLOR; 5 | }; 6 | 7 | OurOutputType 8 | main(float4 position : POSITION, 9 | uniform float4x4 modelViewProj) 10 | { 11 | OurOutputType OUT; 12 | 13 | OUT.position = mul(modelViewProj, position); 14 | OUT.color = position; 15 | 16 | return OUT; 17 | } 18 | -------------------------------------------------------------------------------- /tests/file.cmake: -------------------------------------------------------------------------------- 1 | #[=[ 2 | This is a bracket comment. 3 | TODO markers are recognized here. 4 | ]=] 5 | 6 | # This is a line comment. 7 | # TODO markers are recognized here, too. 8 | 9 | set(words 10 | These are unquoted arguments. 11 | They can include variable references: ${var}, $ENV{var}, 12 | and escape sequences: \n\".) 13 | 14 | message("This is an unquoted argument. 15 | It can also include variable references: ${APPLE}, $ENV{CC}, 16 | and escape sequences: \t\ \\. 17 | In addition, line continuations: \ 18 | are allowed.") 19 | 20 | message("Variable references can nest: ${x$ENV{y${z}w}v}") 21 | 22 | message([==[ 23 | This is a bracket argument. 24 | Variable references (${x}) or escape sequences (\n) 25 | are not processed here. 26 | ]==]) 27 | 28 | # These are examples of legacy unquoted argument syntax 29 | # from the cmake-language manual page. 30 | set(arg_examples 31 | -Da="b c" -Da=$(v) a" "b"c"d # legacy 32 | "-Da=\"b c\"" "-Da=$(v)" "a\" \"b\"c\"d" # quoted equivalents 33 | ) 34 | unset(arg_examples) 35 | 36 | # Control construct example. 37 | if(a EQUAL 5 AND (s STREQUAL "${x}" OR s MATCHES [[\*]])) 38 | endif() 39 | 40 | -------------------------------------------------------------------------------- /tests/file.cob: -------------------------------------------------------------------------------- 1 | IDENTIFICATION DIVISION. 2 | PROGRAM-ID. Age. 3 | AUTHOR. Fernando Brito. 4 | 5 | DATA DIVISION. 6 | WORKING-STORAGE SECTION. 7 | 01 Age PIC 99 VALUE ZEROS. 8 | 01 Had_Birthday PIC X VALUE SPACES. 9 | 01 Current_Year PIC 9999 VALUE 2010. 10 | 01 Result PIC 9999 VALUE ZEROS. 11 | 12 | PROCEDURE DIVISION. 13 | DISPLAY "==> How old are you?". 14 | ACCEPT Age 15 | DISPLAY "==> Had you already had birthday this year (y or n)?". 16 | ACCEPT Had_Birthday 17 | 18 | SUBTRACT Current_Year FROM Age GIVING Result 19 | 20 | IF Had_Birthday = "n" THEN 21 | SUBTRACT 1 FROM Result GIVING Result 22 | END-IF 23 | 24 | DISPLAY "Let me guess... "" You were born in ", Result 25 | STOP RUN. 26 | -------------------------------------------------------------------------------- /tests/file.coffee: -------------------------------------------------------------------------------- 1 | # Assignment: 2 | number = 42 3 | opposite = true 4 | 5 | # Conditions: 6 | number = -42 if opposite 7 | 8 | # Functions: 9 | square = (x) -> x * x 10 | 11 | # Arrays: 12 | list = [1, 2, 3, 4, 5] 13 | 14 | # Objects: 15 | math = 16 | root: Math.sqrt 17 | square: square 18 | cube: (x) -> x * square x 19 | 20 | # Splats: 21 | race = (winner, runners...) -> 22 | print winner, runners 23 | 24 | # Existence: 25 | alert "I knew it!" if elvis? 26 | 27 | # Array comprehensions: 28 | cubes = (math.cube num for num in list) 29 | -------------------------------------------------------------------------------- /tests/file.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /* @charset must: 3 | * be on the first line of the file 4 | * appear at the start of the line 5 | * be lowercase 6 | * followed by one space 7 | * have a double quoted encoding name (encoding is case insensitive) 8 | * be terminated by semicolon, with no preceding space 9 | */ 10 | 11 | .p1 { 12 | font-family: "Times New Roman", Times, serif; 13 | /* A font family name and a generic family name */ 14 | font-family: "Gill Sans Extrabold", sans-serif; 15 | font-family: "Goudy Bookletter 1911", sans-serif; 16 | 17 | /* A generic family name only */ 18 | font-family: serif; 19 | font-family: sans-serif; 20 | font-family: monospace; 21 | font-family: cursive; 22 | font-family: fantasy; 23 | font-family: system-ui; 24 | font-family: ui-serif; 25 | font-family: ui-sans-serif; 26 | font-family: ui-monospace; 27 | font-family: ui-rounded; 28 | font-family: emoji; 29 | font-family: math; 30 | font-family: fangsong; 31 | 32 | /* Global values */ 33 | font-family: inherit; 34 | font-family: initial; 35 | font-family: revert; 36 | font-family: revert-layer; 37 | font-family: unset; 38 | } 39 | 40 | .serif { 41 | font-family: Times, "Times New Roman", Georgia, serif; 42 | } 43 | 44 | .sansserif { 45 | font-family: Verdana, Arial, Helvetica, sans-serif; 46 | } 47 | 48 | .monospace { 49 | font-family: "Lucida Console", Courier, monospace; 50 | } 51 | 52 | .cursive { 53 | font-family: cursive; 54 | } 55 | 56 | .fantasy { 57 | font-family: fantasy; 58 | } 59 | 60 | .emoji { 61 | font-family: emoji; 62 | } 63 | 64 | .math { 65 | font-family: math; 66 | } 67 | 68 | .fangsong { 69 | font-family: fangsong; 70 | } 71 | 72 | .p2 { 73 | font-family: Arial, Helvetica, sans-serif; 74 | } 75 | 76 | .p3 { 77 | font-family: "Lucida Console", "Courier New", monospace; 78 | } 79 | 80 | [id^='ltk--modal']:has([class^='casting-drawer']) { 81 | width: 100%; 82 | } 83 | 84 | /* 85 | * general 86 | */ 87 | :root { 88 | --main-color: #06c; 89 | --accent-color: #006; 90 | --padding: 10px; 91 | --border-radius: 5px; 92 | } 93 | 94 | .box { 95 | padding: var(--padding); 96 | border-radius: var(--border-radius); 97 | margin-bottom: 15px; 98 | } 99 | 100 | #container>.box { 101 | float: left; 102 | padding-bottom: 15px !important; 103 | background-color: hsl(0, 0%, 0%); 104 | } 105 | 106 | h2~p { 107 | margin-bottom: 20px; 108 | } 109 | 110 | p+p { 111 | text-indent: 1.5em; 112 | margin-bottom: 0; 113 | } 114 | 115 | input[type="text"] { 116 | background-color: #444; 117 | width: 200px; 118 | } 119 | 120 | a:hover { 121 | color: red; 122 | } 123 | 124 | .container:before { 125 | content: ""; 126 | display: block; 127 | width: 50px; 128 | height: 50px; 129 | background-color: #141414; 130 | } 131 | 132 | .page-title { 133 | margin-top: 0px; 134 | } 135 | 136 | .group-container { 137 | white-space: nowrap !important; 138 | } 139 | 140 | .group-container .single-group { 141 | vertical-align: top; 142 | display: inline-block; 143 | white-space: normal; 144 | } 145 | 146 | .jumbotron { 147 | position: relative; 148 | overflow: hidden; 149 | display: block; 150 | padding: 0; 151 | background-color: #f0f0f0; 152 | } 153 | 154 | 155 | /* whitespace */ 156 | #main { 157 | color: aqua; 158 | float: left !important; 159 | margin: 0; 160 | width: 161 | 100% ! important; 162 | } 163 | 164 | /* case insensitivity */ 165 | Body { 166 | FONT: 12Px/16pX iTaLiC sans-SERIF; 167 | } 168 | 169 | div[class^="test"] { 170 | background: #ffff00; 171 | } 172 | 173 | /* 174 | * selectors 175 | */ 176 | 177 | /* simple selectors */ 178 | #testID, 179 | /* id */ 180 | .someclass, 181 | /* class */ 182 | div, 183 | /* type */ 184 | *, 185 | /* universal */ 186 | [lang|="zh"] { 187 | /* attribute */ 188 | color: black; 189 | } 190 | 191 | /* combinators */ 192 | header+main, 193 | /* adjacent sibling */ 194 | li~li, 195 | /* general sibling */ 196 | ul>li, 197 | /* child */ 198 | ul ul { 199 | /* descendant */ 200 | color: blue; 201 | } 202 | 203 | /* pseudo-elements */ 204 | :after, 205 | ::after, 206 | ::placeholder, 207 | ::selection { 208 | color: green; 209 | } 210 | 211 | /* pseudo-classes */ 212 | :hover, 213 | :required, 214 | :lang(fr), 215 | :not(div#sidebar.fancy), 216 | :nth-child(n+1), 217 | :nth-last-child(-2n - 30), 218 | :nth-of-type(5), 219 | :nth-last-of-type(even) { 220 | color: yellow; 221 | } 222 | 223 | /* pseudo-classes with invalid arguments */ 224 | :not(div:before), 225 | /* pseudo-element */ 226 | :not(input::placeholder), 227 | /* pseudo-element */ 228 | :not(p:not(:lang(en))), 229 | /* nested :not */ 230 | :nth-child(1.2n), 231 | /* non-integer */ 232 | :nth-child(.5), 233 | /* non-integer */ 234 | :nth-child(n+-1) { 235 | /* number sign */ 236 | color: red; 237 | } 238 | 239 | /* namespace qualified */ 240 | a, 241 | /* type in default namespace */ 242 | svg|a, 243 | /* type in specified namespace */ 244 | |a, 245 | /* type in no namespace */ 246 | *|a, 247 | /* type in all namespaces (including no namespace) */ 248 | svg|*, 249 | /* universal */ 250 | svg|[fill] { 251 | /* attribute */ 252 | color: white; 253 | } 254 | 255 | 256 | /* 257 | * basic data types 258 | */ 259 | 260 | #main { 261 | /* angle */ 262 | transform: rotate(+33.333e+3deg); 263 | 264 | /* color */ 265 | color: #f00; 266 | color: #f00f; 267 | /* #rgba */ 268 | color: #ff0000; 269 | color: #ff0000ff; 270 | /* #rrggbbaa */ 271 | color: red; 272 | color: lightgoldenrodyellow; 273 | color: rebeccapurple; 274 | color: currentColor; 275 | 276 | /* freqency (not currently used for any property) */ 277 | content: 44.1kHz; 278 | 279 | /* integer */ 280 | z-index: +255; 281 | z-index: -1; 282 | 283 | /* length */ 284 | width: 10px; 285 | width: 10.5rem; 286 | width: -10e-2vw; 287 | 288 | /* number */ 289 | opacity: .5; 290 | opacity: 0.3333; 291 | opacity: 1; 292 | opacity: 2e-34; 293 | 294 | /* percentage */ 295 | width: 100%; 296 | 297 | /* string */ 298 | content: "double quoted"; 299 | content: 'single quoted'; 300 | 301 | /* time */ 302 | transition-duration: .4s; 303 | transition-duration: 400ms; 304 | 305 | /* unicode range */ 306 | unicode-range: U+0025-00FF; 307 | unicode-range: U+4??; 308 | /* wildcard range */ 309 | } 310 | 311 | /* ratio */ 312 | @media (min-aspect-ratio: 16/9) {} 313 | 314 | /* resolution */ 315 | @media (min-resolution: +2.54dpcm) {} 316 | 317 | 318 | /* 319 | * identifiers 320 | */ 321 | 322 | /* leading hyphens */ 323 | #-here.-there, 324 | #-- .--everywhere { 325 | /* two hyphens: https://stackoverflow.com/a/30822662 */ 326 | color: blue; 327 | } 328 | 329 | /* non-ASCII */ 330 | #español, 331 | #你好, 332 | .❤♫ { 333 | color: green; 334 | } 335 | 336 | /* invalid identifiers */ 337 | #1id, 338 | /* starts with digit */ 339 | .-2class { 340 | /* starts with hyphen digit */ 341 | color: maroon; 342 | } 343 | 344 | 345 | /* 346 | * escaping 347 | */ 348 | 349 | /* selectors */ 350 | #\..\+\ space\@\>, 351 | /* special character escape */ 352 | #\E9 dition .\0000E9dition .motion_\e9motion, 353 | /* Unicode character escape */ 354 | .\e33 div, 355 | /* trailing space terminates Unicode character escape */ 356 | .\e33 div, 357 | /* extra space to denote separate tokens */ 358 | .\31 23 { 359 | /* escape leading digit of identifier */ 360 | 361 | /* property value */ 362 | content: "\E9 dition \" 363 | 364 | } 365 | 366 | 367 | /* 368 | * functions 369 | */ 370 | 371 | #main { 372 | /* url */ 373 | background: url("image.svg"); 374 | 375 | /* function argument keywords */ 376 | background-image: linear-gradient(to left top, #fff, blue); 377 | grid-template-columns: repeat(2, minmax(max-content, 300px) 1fr) 100px; 378 | } 379 | 380 | 381 | /* 382 | * style properties 383 | */ 384 | 385 | #main { 386 | /* svg */ 387 | fill: url(#pattern); 388 | text-rendering: optimizeLegibility; 389 | 390 | /* css3 */ 391 | font-variant-east-asian: jis04; 392 | size: letter; 393 | transition-timing-function: ease-in; 394 | 395 | /* animatable */ 396 | transition-property: height, font-size, visibility; 397 | color: black; 398 | 399 | transition-property: height, font-size, visibility; 400 | } 401 | 402 | /* 403 | * modifiers 404 | */ 405 | body { 406 | background: pink !important; 407 | } 408 | 409 | 410 | [id^='ltk--modal']:has([class^='casting-drawer']) { 411 | width: 100%; 412 | } 413 | 414 | /* 415 | * media queries 416 | */ 417 | 418 | @media screen, 419 | (orientation: portrait) {} 420 | 421 | @media not screen and (color), 422 | print and (color) { 423 | /* … */ 424 | } 425 | 426 | @media not all and (monochrome) { 427 | /* … */ 428 | } 429 | 430 | @media only screen {} 431 | 432 | @media all and (not(hover)) { 433 | /* … */ 434 | } 435 | 436 | @media (not (color)) or (hover) { 437 | /* … */ 438 | } 439 | 440 | @media not print {} 441 | 442 | @media print and (orientation: portrait) { 443 | /* … */ 444 | } 445 | 446 | /* 447 | * at-rules 448 | */ 449 | 450 | /* @font-face */ 451 | @font-face { 452 | font-family: MyHelvetica; 453 | src: local("Helvetica Neue"), 454 | local("HelveticaNeue"), 455 | url(MgOpenModerna.ttf); 456 | } 457 | 458 | /* @font-feature-values */ 459 | @font-feature-values Font One { 460 | @styleset { 461 | nice-style: 12; 462 | } 463 | } 464 | 465 | .nice-look { 466 | font-variant-alternates: styleset(nice-style); 467 | } 468 | 469 | /* @import */ 470 | @import URL("fineprint.css"); 471 | @import 'custom.css'; 472 | @import url('landscape.css') screen and (orientation: landscape), print; 473 | @import URL('fineprint.css'); 474 | @import 'custom.css'; 475 | @import url('landscape.css'); 476 | @import url("fineprint.css") print; 477 | @import url("bluish.css") print, screen; 478 | @import "common.css" screen; 479 | @import url("landscape.css") screen and (orientation: landscape); 480 | 481 | /* @keyframes */ 482 | @keyframes myanim { 483 | from { 484 | opacity: 0.0; 485 | } 486 | 487 | 50% { 488 | opacity: 0.5; 489 | } 490 | 491 | to { 492 | opacity: 1.0; 493 | } 494 | } 495 | 496 | /* @media */ 497 | @media all { 498 | body { 499 | background: gray; 500 | } 501 | 502 | @media screen, 503 | (orientation: portrait) { 504 | body { 505 | background: grey; 506 | } 507 | } 508 | } 509 | 510 | /* @namespace */ 511 | @namespace "http://www.w3.org/1999/xhtml"; 512 | @namespace svg url(http://www.w3.org/2000/svg); 513 | 514 | /* @page */ 515 | @page { 516 | bleed: 1cm; 517 | } 518 | 519 | @page toc, 520 | :blank { 521 | margin: 2cm; 522 | marks: crop cross; 523 | } 524 | 525 | @page index:left { 526 | size: A4; 527 | 528 | @top-right { 529 | content: "Page " counter(page); 530 | } 531 | } 532 | 533 | /* @supports */ 534 | @supports (animation-name: test) { 535 | @keyframes 'my-complicated-animation' { 536 | 0% { 537 | width: 0; 538 | } 539 | 540 | 100% { 541 | width: 100%; 542 | } 543 | } 544 | } 545 | 546 | 547 | /* 548 | * vendor-specific extensions 549 | */ 550 | 551 | /* pseudo-elements */ 552 | input[type="number"]::-webkit-outer-spin-button, 553 | input[type="number"]::-webkit-inner-spin-button { 554 | -webkit-appearance: none; 555 | } 556 | 557 | input[type="number"] { 558 | -moz-appearance: textfield; 559 | } 560 | 561 | /* pseudo-classes */ 562 | #page:-moz-full-screen, 563 | #page:-ms-fullscreen, 564 | #page:-webkit-full-screen { 565 | background: silver; 566 | } 567 | 568 | /* functions */ 569 | .footer { 570 | background-image: -webkit-linear-gradient(to left top, #fff, blue); 571 | z-index: +233; 572 | z-index: -233; 573 | } 574 | 575 | /* style properties */ 576 | #sidebar { 577 | -ms-overflow-style: -ms-autohiding-scrollbar; 578 | } 579 | 580 | @supports not ((text-align-last: justify) or (-moz-text-align-last: justify)) { 581 | body { 582 | text-align: justify; 583 | } 584 | } 585 | 586 | /* at-rules */ 587 | @-webkit-keyframes myanim { 588 | from { 589 | opacity: 0.0; 590 | } 591 | 592 | 50% { 593 | opacity: 0.5; 594 | } 595 | 596 | to { 597 | opacity: 1.0; 598 | } 599 | } 600 | 601 | @media print { 602 | body { 603 | font-size: 10pt; 604 | } 605 | } 606 | 607 | @media screen { 608 | body { 609 | font-size: 13px; 610 | } 611 | } 612 | 613 | @media screen, 614 | print { 615 | body { 616 | line-height: 1.2; 617 | } 618 | } 619 | 620 | @media only screen and (min-width: 320px) and (max-width: 480px) and (resolution: 150dpi) { 621 | body { 622 | line-height: 1.4; 623 | } 624 | } 625 | 626 | @media (height > 600px) { 627 | body { 628 | line-height: 1.4; 629 | } 630 | } 631 | 632 | @media (400px <=width <=700px) { 633 | body { 634 | line-height: 1.4; 635 | } 636 | } -------------------------------------------------------------------------------- /tests/file.csv: -------------------------------------------------------------------------------- 1 | 01,47.498333,19.040833,Unquoted field 2 | 02,60.317222,24.963333,"Double-quoted field" 3 | 03,51.507222,-.1275,"Punctuated , double-quoted, field." 4 | 04,472.181E-01, -1.5528e+00,"""Escaped"" double quote in double-quoted field" 5 | -------------------------------------------------------------------------------- /tests/file.cu: -------------------------------------------------------------------------------- 1 | #include "cuMatrix.h" 2 | 3 | __global__ void make_BlackWhite(int *image, int N){ 4 | unsigned int x = blockIdx.x * blockDim.x + threadIdx.x; 5 | unsigned int y = blockIdx.y * blockDim.y + threadIdx.y; 6 | 7 | image[y*N + x] = image[y*N + x] > 128 ? 255 : 0; 8 | } 9 | 10 | void convertToArray(int **matrix, int *array, int N){ 11 | for(unsigned int i=0; i< N; i++) 12 | for(unsigned int j=0; j< N; j++) 13 | array[i*N+ j] = matrix[i][j]; 14 | } 15 | 16 | // Wrapper function for kernel launch (not the complete function, just an example). 17 | template 18 | void 19 | reduce(int size, int threads, int blocks, 20 | int whichKernel, T *d_idata, T *d_odata) 21 | { 22 | dim3 dimBlock(threads, 1, 1); 23 | dim3 dimGrid(blocks, 1, 1); 24 | 25 | // when there is only one warp per block, we need to allocate two warps 26 | // worth of shared memory so that we don't index shared memory out of bounds 27 | int smemSize = (threads <= 32) ? 2 * threads * sizeof(T) : threads * sizeof(T); 28 | 29 | // choose which of the optimized versions of reduction to launch 30 | switch (whichKernel) 31 | { 32 | case 0: 33 | reduce0<<< dimGrid, dimBlock, smemSize >>>(d_idata, d_odata, size); 34 | break; 35 | 36 | case 1: 37 | reduce1<<< dimGrid, dimBlock, smemSize >>>(d_idata, d_odata, size); 38 | break; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/file.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' show Random; 2 | 3 | Future main() async { 4 | print('Compute π using the Monte Carlo method.'); 5 | await for (var estimate in computePi().take(500)) { 6 | print('π ≅ $estimate'); 7 | } 8 | } 9 | 10 | /// Generates a [Stream] of increasingly accurate estimates of `π`. 11 | Stream computePi({int batch = 100000}) async* { 12 | var total = 0; 13 | var count = 0; 14 | while (true) { 15 | var points = generateRandom().take(batch); 16 | var inside = points.where((p) => p.isInsideUnitCircle); 17 | total += batch; 18 | count += inside.length; 19 | var ratio = count / total; 20 | // Area of a circle is A = π⋅r², therefore π = A/r². 21 | // So, when given random points with x ∈ <0,1>, 22 | // y ∈ <0,1>, the ratio of those inside a unit circle 23 | // should approach π / 4. Therefore, the value of π 24 | // should be: 25 | yield ratio * 4; 26 | } 27 | } 28 | 29 | Iterable generateRandom([int seed]) sync* { 30 | final random = Random(seed); 31 | while (true) { 32 | yield Point(random.nextDouble(), random.nextDouble()); 33 | } 34 | } 35 | 36 | class Point { 37 | final double x, y; 38 | const Point(this.x, this.y); 39 | bool get isInsideUnitCircle => x * x + y * y <= 1; 40 | 41 | @override 42 | String toString() => 'Point($x, $y)'; 43 | } 44 | -------------------------------------------------------------------------------- /tests/file.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | _Name=medit 4 | _Comment=Text editor 5 | Exec=medit %F 6 | # blah blah blah 7 | Terminal=false 8 | Type=Application 9 | StartupNotify=true 10 | MimeType=text/plain; 11 | Icon=medit.png 12 | Categories=Application;Utility;TextEditor; 13 | -------------------------------------------------------------------------------- /tests/file.diff: -------------------------------------------------------------------------------- 1 | diff -r 231ed68760a0 moo/moofileview/moofileview.c 2 | --- a/moo/moofileview/moofileview.c Wed Dec 20 21:08:14 2006 -0600 3 | +++ b/moo/moofileview/moofileview.c Wed Dec 20 20:33:06 2006 -0600 4 | @@ -1407,7 +1413,7 @@ create_toolbar (MooFileView *fileview) 5 | 6 | gtk_toolbar_set_tooltips (toolbar, TRUE); 7 | gtk_toolbar_set_style (toolbar, GTK_TOOLBAR_ICONS); 8 | - gtk_toolbar_set_icon_size (toolbar, GTK_ICON_SIZE_MENU); 9 | + gtk_toolbar_set_icon_size (toolbar, TOOLBAR_ICON_SIZE); 10 | 11 | _moo_file_view_setup_button_drag_dest (fileview, "MooFileView/Toolbar/GoUp", "go-up"); 12 | _moo_file_view_setup_button_drag_dest (fileview, "MooFileView/Toolbar/GoBack", "go-back"); 13 | -------------------------------------------------------------------------------- /tests/file.dtd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 16 | -------------------------------------------------------------------------------- /tests/file.dtl: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load static %} 4 | {# Comment #} 5 | 6 |
    7 | {% if table %} 8 | Table:
    9 | {{ table.data }} 10 | {% endif %} 11 | 12 | Filter: {{ table.date|date:"Y-m-d" }} 13 | Link: Overview 14 |
    15 | -------------------------------------------------------------------------------- /tests/file.exs: -------------------------------------------------------------------------------- 1 | # Elixir Syntax Highlighting Test File (.ex or .exs) 2 | 3 | # --- Module Documentation --- 4 | @moduledoc """ 5 | This module serves as a comprehensive test case for Elixir syntax 6 | highlighting in various editors and themes. It includes examples of 7 | modules, functions, macros, typespecs, data structures, control flow, 8 | sigils, comments, and common patterns. 9 | 10 | It includes features up to recent Elixir versions. 11 | """ 12 | 13 | # --- Module Definition and Directives --- 14 | defmodule ElixirSyntaxTest do 15 | @moduledoc false # Disable outer documentation for this specific module example 16 | 17 | # --- Imports and Aliases --- 18 | alias __MODULE__, as: Test # Self alias 19 | alias ElixirSyntaxTest.NestedModule # Alias nested module 20 | require Logger # Require Logger for macro usage (e.g., Logger.debug) 21 | import Kernel, except: [inspect: 1] # Import functions from Kernel, excluding one arity 22 | import List, only: [flatten: 1] # Import specific function 23 | use GenServer # Use behaviour (pulls in callbacks, etc.) 24 | 25 | # --- Module Attributes --- 26 | @behaviour GenServer # Explicitly defining behaviour adherence 27 | @compile {:inline, my_inline_fun: 1} # Compiler options 28 | @external_resource "path/to/resource.txt" # External resource tracking 29 | @my_custom_attribute :some_value # Custom module attribute 30 | @another_attr {"a tuple", 123} 31 | 32 | # --- Typespecs (Common with Dialyzer) --- 33 | @type config :: keyword() | map() | nil 34 | @type user_id :: String.t() | integer() 35 | @opaque internal_state :: %{required(:data) => any(), optional(:cache) => map()} 36 | 37 | @spec process_data(data :: any(), options :: config()) :: {:ok, result :: map()} | {:error, reason :: atom()} 38 | @callback handle_info(msg :: any(), state :: internal_state()) :: 39 | {:noreply, internal_state()} # Example behaviour callback spec 40 | 41 | # --- Struct Definition --- 42 | defstruct name: "Default Name", # Default value 43 | age: 0, 44 | tags: [:elixir, :syntax], # List as default 45 | metadata: %{} # Map as default 46 | 47 | # --- Constants (using module attributes) --- 48 | @default_timeout 5000 49 | @api_version "v1.0" 50 | 51 | # --- Public Function Definitions --- 52 | 53 | @doc """ 54 | Public function example with multiple clauses, pattern matching, guards, 55 | and default arguments. Uses typespecs. 56 | """ 57 | @spec greet(name :: String.t(), greeting \\ "Hello") :: String.t() | {:error, :invalid_name} 58 | def greet(name, greeting \\ "Hello") # Default argument 59 | 60 | # Function clause with pattern matching and guard 61 | def greet(name, greeting) when is_binary(name) and name != "" do 62 | formatted_greeting = greeting |> String.capitalize() # Using pipe operator 63 | "#{formatted_greeting}, #{name}!" # String interpolation 64 | end 65 | 66 | # Another function clause 67 | def greet(nil, _greeting) do 68 | # Using custom module attribute 69 | Logger.warn("Received nil name. Custom attribute: #{@my_custom_attribute}") 70 | {:error, :invalid_name} 71 | end 72 | 73 | # Catch-all clause 74 | def greet(_, _) do 75 | {:error, :invalid_name} 76 | end 77 | 78 | # --- Pattern Matching Examples --- 79 | def handle_tuple({:ok, value}), do: "Success with value: #{inspect(value)}" # Single line function 80 | def handle_tuple({:error, reason}), do: "Error: #{reason}" 81 | def handle_tuple(_), do: "Unknown tuple format" 82 | 83 | def handle_map(%{status: "active", name: name}), do: "Active user: #{name}" 84 | def handle_map(%{status: "pending"}), do: "User is pending" 85 | def handle_map(other_map) when is_map(other_map), do: "Some other map" 86 | 87 | # --- Private Functions --- 88 | defp calculate(x, y) when is_integer(x) and is_integer(y) do 89 | # Local variable assignment (matching) 90 | sum = x + y 91 | product = x * y 92 | # Tuple return 93 | {sum, product} 94 | end 95 | 96 | # --- Macros --- 97 | # Simple macro example 98 | defmacro __using__(_opts) do 99 | quote do 100 | # Code injected into the calling module 101 | import ElixirSyntaxTest, only: [utility_function: 0] 102 | @before_compile ElixirSyntaxTest # Register compile callback 103 | end 104 | end 105 | 106 | # Compile callback example 107 | defmacro __before_compile__(_env) do 108 | quote do 109 | def injected_function, do: "I was injected!" 110 | end 111 | end 112 | 113 | # Public function likely defined by `use GenServer` or a macro 114 | def utility_function, do: :utility_result 115 | 116 | # --- Variables, Literals, and Data Structures --- 117 | def data_examples do 118 | # --- Atoms --- 119 | status = :ok 120 | error_reason = :not_found 121 | bool_true = true 122 | bool_false = false 123 | nil_val = nil 124 | module_atom = Kernel # Module names are atoms 125 | 126 | # --- Numbers --- 127 | integer_val = 1_234_567 # Integer with underscore separator 128 | float_val = 3.14159 129 | scientific_float = 6.022e23 130 | hex_val = 0xFE_01 # Hexadecimal 131 | octal_val = 0o755 # Octal 132 | binary_val = 0b1010_1100 # Binary 133 | 134 | # --- Strings & Charlists --- 135 | string_val = "Hello\nWorld! with interpolation: #{integer_val}" # Double quotes, interpolation, escapes 136 | charlist_val = 'charlist example' # Single quotes 137 | 138 | # --- Binaries --- 139 | binary_val = <<1, 2, 3>> # Simple binary 140 | bitstring_val = <<1::size(1), 7::size(3)>> # Bitstring with sizes 141 | utf8_binary = <<"你好"::utf8>> 142 | mixed_binary = <<10, "rest"::binary>> 143 | 144 | # --- Lists --- 145 | simple_list = [1, 2, 3, status] 146 | keyword_list = [name: "Alice", age: 30, active: true] # Keyword list (syntactic sugar) 147 | improper_list = [1, 2 | 3] # Improper list with '|' 148 | list_concat = simple_list ++ [4, 5] # List concatenation 149 | list_subtract = list_concat -- [1, 3] # List subtraction 150 | 151 | # --- Tuples --- 152 | simple_tuple = {:data, 123, "info"} 153 | two_tuple = {status, "Operation succeeded"} 154 | 155 | # --- Maps --- 156 | simple_map = %{name: "Bob", age: 25} # Map with atom keys 157 | map_with_string_keys = %{"first_name" => "Bob", "last_name" => "Smith"} # Map with string keys 158 | map_access = simple_map.name # Access using dot notation (atom keys only) 159 | map_access_bracket = simple_map[:age] # Access using bracket notation 160 | # Map update syntax 161 | updated_map = %{simple_map | age: 26, status: :updated} 162 | 163 | # --- Structs --- 164 | # Using `defstruct` defined earlier 165 | default_struct = %ElixirSyntaxTest{} 166 | custom_struct = %ElixirSyntaxTest{name: "Custom Name", age: 10} 167 | updated_struct = %{custom_struct | age: 11} 168 | 169 | # --- Sigils --- 170 | regex_val = ~r/elixir\s+syntax/i # Regular expression sigil 171 | string_sigil = ~s(this is a string) # String sigil (alternative quoting) 172 | charlist_sigil = ~c(this is a charlist) # Charlist sigil 173 | word_list_sigil = ~w(one two three four)a # Word list sigil (atoms) 174 | word_list_strings = ~w(one two three four)s # Word list sigil (strings) 175 | naive_datetime_sigil = ~N[2025-04-28 18:59:00] # NaiveDateTime sigil 176 | utc_datetime_sigil = ~U[2025-04-28 18:59:00Z] # UtcDateTime sigil 177 | date_sigil = ~D[2025-04-28] # Date sigil 178 | time_sigil = ~T[18:59:00.123] # Time sigil 179 | 180 | # --- Ranges and Comprehensions --- 181 | number_range = 1..10 # Integer range 182 | squares = for n <- number_range, rem(n, 2) == 0, do: n * n # 'for' comprehension with filter 183 | # Comprehension into a map 184 | map_comp = for i <- 1..3, into: %{}, do: {:"key_#{i}", i * 10} 185 | 186 | # --- Pin Operator --- 187 | existing_value = "Pin me" 188 | # Match fails unless pinned 189 | # {^existing_value, _} = {"Don't match me", 1} # This would raise MatchError 190 | # Match succeeds 191 | {^existing_value, number} = {"Pin me", 42} 192 | 193 | # Return a map of examples 194 | %{ 195 | atom: status, 196 | number: integer_val, 197 | float: float_val, 198 | string: string_val, 199 | charlist: charlist_val, 200 | binary: binary_val, 201 | list: simple_list, 202 | keyword: keyword_list, 203 | tuple: simple_tuple, 204 | map: simple_map, 205 | struct: custom_struct, 206 | sigil_regex: regex_val, 207 | range: number_range, 208 | comprehension_list: squares, 209 | comprehension_map: map_comp, 210 | pinned_number: number 211 | } 212 | end 213 | 214 | # --- Control Flow --- 215 | def control_flow_examples(input) do 216 | # --- If / Unless --- 217 | # `if` is an expression 218 | result_if = 219 | if is_integer(input) and input > 0 do 220 | "Positive integer" 221 | else 222 | "Not a positive integer" 223 | end 224 | 225 | # `unless` is the opposite of `if` 226 | unless is_nil(input) do 227 | Logger.info("Input is not nil") 228 | end 229 | 230 | # --- Case --- 231 | # Pattern matching control flow 232 | result_case = 233 | case input do 234 | {:ok, value} -> 235 | "Case matched OK: #{value}" 236 | 237 | {:error, reason} when is_atom(reason) -> # Case with guard 238 | "Case matched Error: #{reason}" 239 | 240 | %ElixirSyntaxTest{name: name} -> # Match struct 241 | "Case matched Struct: #{name}" 242 | 243 | _other -> # Catch-all pattern using underscore 244 | "Case matched other value: #{inspect(_other)}" 245 | end 246 | 247 | # --- Cond --- 248 | # Evaluates boolean conditions sequentially 249 | result_cond = 250 | cond do 251 | is_binary(input) and String.length(input) > 10 -> 252 | "Cond: Long string" 253 | 254 | is_integer(input) -> 255 | "Cond: Integer input" 256 | 257 | is_list(input) -> 258 | "Cond: List input" 259 | 260 | true -> # Default condition (always true) 261 | "Cond: Some other input type" 262 | end 263 | 264 | # --- With --- 265 | # Chains successful pattern matches 266 | result_with = 267 | with {:ok, name} <- Map.fetch(%{name: "Alice"}, :name), # Successful match continues 268 | {:ok, age} <- Map.fetch(%{age: 30}, :age), 269 | # This would fail if :height wasn't present: 270 | # {:ok, height} <- Map.fetch(%{height: 170}, :height), 271 | true <- age > 25 do # Can match on boolean results 272 | # Success block 273 | "With Success: #{name} is #{age} and older than 25" 274 | else 275 | # Failure block (matches the value that caused the failure) 276 | :error -> 277 | "With Error: Failed to fetch a required key" 278 | 279 | false -> 280 | "With Error: Age condition not met" 281 | 282 | _other_error -> # Catch any other non-matching value 283 | "With Error: Unknown failure - #{inspect(_other_error)}" 284 | end 285 | 286 | {result_if, result_case, result_cond, result_with} 287 | end 288 | 289 | # --- Error Handling --- 290 | def error_handling_example(param) do 291 | try do 292 | # Code that might raise an error or throw/exit 293 | case param do 294 | :raise -> raise "This is a runtime error" 295 | :throw -> throw :some_thrown_value 296 | :exit -> exit(:shutdown) 297 | :error -> %{}[:non_existent_key] # Raises KeyError 298 | :ok -> :everything_is_fine 299 | _ -> :unknown_param 300 | end 301 | rescue # Rescue specific errors 302 | e in [KeyError, RuntimeError] -> 303 | Logger.error("Rescued a KeyError or RuntimeError: #{inspect(e)}") 304 | {:rescued, e.__struct__} # Return error type atom 305 | catch type, value -> # Catch throws, exits, or errors 306 | Logger.warn("Caught #{type}: #{inspect(value)}") 307 | {:caught, type} 308 | after # Always executed 309 | Logger.info("Error handling 'after' block executed.") 310 | end 311 | end 312 | 313 | # --- Concurrency Primitives (Basic Examples) --- 314 | def concurrency_example do 315 | parent = self() # Get current process PID 316 | 317 | # Spawn a new process executing a function 318 | spawn(fn -> 319 | # Send a message back to the parent process 320 | send(parent, {:message_from_spawn, "Hello from spawned process!", self()}) 321 | 322 | # Receive messages 323 | receive do 324 | {:reply, data} -> 325 | Logger.info("Spawned process received reply: #{inspect(data)}") 326 | _other -> 327 | Logger.info("Spawned process received unexpected message: #{inspect(_other)}") 328 | after # Optional timeout 329 | @default_timeout -> Logger.warn("Spawned process timed out waiting for reply.") 330 | end 331 | end) 332 | 333 | # Wait to receive the message from the spawned process 334 | receive do 335 | {:message_from_spawn, msg, sender_pid} -> 336 | Logger.info("Parent received: '#{msg}' from #{inspect(sender_pid)}") 337 | # Send a reply back 338 | send(sender_pid, {:reply, :world}) 339 | after 340 | 1000 -> # Timeout in milliseconds 341 | Logger.error("Parent timed out waiting for message from spawn.") 342 | end 343 | } 344 | 345 | # --- GenServer Callbacks (Examples, matching `use GenServer`) --- 346 | @impl GenServer 347 | def init(args) do 348 | Logger.info("GenServer init with args: #{inspect(args)}") 349 | initial_state = %{data: args, cache: %{}} 350 | {:ok, initial_state} 351 | end 352 | 353 | @impl GenServer 354 | def handle_call(:get_state, _from, state) do 355 | {:reply, state, state} # Reply with current state 356 | end 357 | 358 | @impl GenServer 359 | def handle_cast({:update_data, new_data}, state) do 360 | new_state = %{state | data: new_data} 361 | {:noreply, new_state} 362 | end 363 | 364 | @impl GenServer 365 | def handle_info(:tick, state) do 366 | Logger.debug("GenServer received :tick info message.") 367 | # Perform periodic task maybe 368 | {:noreply, state} 369 | end 370 | 371 | # --- Protocols & Behaviours (Conceptual Placement) --- 372 | # defprotocol MyProtocol do 373 | # @doc "Protocol function documentation" 374 | # @spec my_proto_fun(t) :: String.t 375 | # def my_proto_fun(data) 376 | # end 377 | 378 | # defimpl MyProtocol, for: List do 379 | # def my_proto_fun(list_data) do 380 | # "Implementing protocol for List: #{inspect list_data}" 381 | # end 382 | # end 383 | 384 | end 385 | 386 | # --- Nested Module Example --- 387 | defmodule ElixirSyntaxTest.NestedModule do 388 | @moduledoc "A nested module example." 389 | def nested_function, do: "Result from nested function" 390 | end 391 | 392 | # --- Scripting Part (if run as .exs) --- 393 | # This code runs when the file is executed as a script 394 | if System.get_env("RUN_EXAMPLES") == "true" do 395 | IO.puts("\n--- Running Elixir Syntax Examples ---") 396 | 397 | # Call some functions 398 | IO.inspect(ElixirSyntaxTest.greet("World")) 399 | IO.inspect(ElixirSyntaxTest.greet(nil)) 400 | IO.inspect(ElixirSyntaxTest.handle_tuple({:ok, 123})) 401 | IO.inspect(ElixirSyntaxTest.handle_map(%{status: "active", name: "Test"})) 402 | 403 | # Show data structures 404 | IO.inspect(ElixirSyntaxTest.data_examples(), label: "\nData Examples") 405 | 406 | # Show control flow 407 | IO.inspect(ElixirSyntaxTest.control_flow_examples([1, 2]), label: "\nControl Flow (List)") 408 | IO.inspect(ElixirSyntaxTest.control_flow_examples({:error, :timeout}), label: "\nControl Flow (Error Tuple)") 409 | 410 | # Show error handling 411 | IO.inspect(ElixirSyntaxTest.error_handling_example(:ok), label: "\nError Handling (:ok)") 412 | IO.inspect(ElixirSyntaxTest.error_handling_example(:error), label: "\nError Handling (:error)") 413 | IO.inspect(ElixirSyntaxTest.error_handling_example(:throw), label: "\nError Handling (:throw)") 414 | 415 | # Run concurrency example (will print logs) 416 | IO.puts("\n--- Running Concurrency Example ---") 417 | ElixirSyntaxTest.concurrency_example() 418 | Process.sleep(1500) # Give time for messages to be processed 419 | 420 | IO.puts("\n--- Elixir Syntax Examples Finished ---") 421 | end 422 | 423 | # Example of calling an injected function from a macro 424 | # IO.puts ElixirSyntaxTest.injected_function() -------------------------------------------------------------------------------- /tests/file.f: -------------------------------------------------------------------------------- 1 | ! gtk-source-lang: fortran 2 | program test95 3 | ! Comment: This is a Fortran free-form program 4 | !$ use omp_lib 5 | ! The previous line is not a comment, but an OpenMP directive 6 | implicit none 7 | character(len=9),parameter :: t='Some text' 8 | integer,parameter :: a=1 9 | real,parameter :: r1=1.23e0, r2=.12, r3=12., r4=12.12, r5=1.d0 10 | !$ real*8 :: t1, t2 11 | integer :: i 12 | 13 | !$ t1 = omp_get_wtime() 14 | if ( .true. ) then 15 | print *, a, t 16 | print *,size( (/ r1, r2, r3, r4, r5 /) ) 17 | endif 18 | ! parallel do 19 | do i=1,100 20 | print *,i 21 | enddo ! i 22 | ! end parallel do 23 | !$ t2 = omp_get_wtime() 24 | !$ print *,'The loop took ',t2-t1,'seconds' 25 | end program 26 | -------------------------------------------------------------------------------- /tests/file.fcl: -------------------------------------------------------------------------------- 1 | FUNCTION_BLOCK explore 2 | 3 | VAR_INPUT 4 | front : REAL; 5 | left : REAL; 6 | right : REAL; 7 | END_VAR 8 | 9 | VAR_OUTPUT 10 | velocity : REAL; 11 | angular_velocity : REAL; 12 | END_VAR 13 | -------------------------------------------------------------------------------- /tests/file.frt: -------------------------------------------------------------------------------- 1 | \ gtk-source-lang: forth 2 | -- comment 3 | (* comment! 4 | here still comment 5 | *) 6 | NEEDS something 7 | IF 0 THEN ENDIF 8 | Numbers: 1234 33 #345325 %01000 9 | -------------------------------------------------------------------------------- /tests/file.fs: -------------------------------------------------------------------------------- 1 | (* Simple F# sample *) 2 | let rec map func lst = 3 | match lst with 4 | | [] -> [] 5 | | head :: tail -> func head :: map func tail 6 | 7 | let myList = [1;3;5] 8 | let newList = map (fun x -> x + 1) myList 9 | -------------------------------------------------------------------------------- /tests/file.g: -------------------------------------------------------------------------------- 1 | for i in [1..10] do 2 | Print("blah blah blah\n"); 3 | od; 4 | -------------------------------------------------------------------------------- /tests/file.gdb: -------------------------------------------------------------------------------- 1 | Reading symbols from /home/foo/a.out...done. 2 | Starting program: /home/foo/a.out 3 | 4 | Program received signal SIGSEGV, Segmentation fault. 5 | 0x00000000004007e2 in baz () 6 | Thread 2 (Thread 0x7fffe5fc1700 (LWP 24296)): 7 | #0 0x00007ffff2ac984d in poll () at ../sysdeps/unix/syscall-template.S:81 8 | #1 0x00007ffff3d16ee4 in g_main_context_poll (priority=2147483647, n_fds=1, fds=0x7fffe00010e0, timeout=-1, context=0x8d6320) at /build+thing/buildd/glib2.0-2.42.1/./glib/gmain.c:4076 9 | #2 g_main_context_iterate (context=context@entry=0x8d6320, block=block@entry=1, dispatch=dispatch@entry=1, self=) at /build+thing/buildd/glib2.0-2.42.1/./glib/gmain.c:3776 10 | #3 0x00007ffff3d16ffc in g_main_context_iteration (context=0x8d6320, 11 | may_block=1) at /build+thing/buildd/glib2.0-2.42.1/./glib/gmain.c:3842 12 | #4 0x00007fffe5fc927d in ?? () from /usr/lib/x86_64-linux-gnu/gio/modules/libdconfsettings.so 13 | #5 0x00007ffff3d3d925 in g_thread_proxy (data=0x737140) 14 | at /build~stuff/buildd/glib2.0-2.42.1/./glib/gthread.c:764 15 | #6 0x00007ffff2da60a5 in start_thread (arg=0x7fffe5fc1700) at pthread_create.c:309 16 | #7 0x00007ffff2ad3cfd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111 17 | Thread 1 (Thread 0x7ffff7fa1a40 (LWP 24267)): 18 | #0 0x00007ffff74007e2 in baz () 19 | #1 0x00007ffff74009f2 in bar (str=0x7ffff3412d85 "hello") 20 | #2 0x00007ffff74003f2 in func2 () from /tmp/ничего/libnothing1.so 21 | #3 0x00007ffff74013f2 in func1 () from /tmp/何も/libnothing2.so 22 | #4 0x00007ffff74007c4 in main () 23 | 24 | Load new symbol table from "/home/foo/b.out"? (y or n) Reading symbols from /home/foo/b.out...done. 25 | Starting program: /home/foo/b.out 26 | [Thread debugging using libthread_db enabled] 27 | Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 28 | [New process 9943] 29 | [Thread debugging using libthread_db enabled] 30 | Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 31 | [New Thread 0x7ffff77f7700 (LWP 9944)] 32 | [Thread 0x7ffff77f7700 (LWP 9944) exited] 33 | [Inferior 1 (process 9943) exited with code 01] 34 | [New Thread 0x7ffff77f7700 (LWP 9947)] 35 | 36 | Program received signal SIGABRT, Aborted. 37 | [Switching to Thread 0x7ffff77f7700 (LWP 9947)] 38 | 0x00007ffff782ee37 in __GI_raise (sig=sig@entry=6) 39 | at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 40 | 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. 41 | 42 | Load new symbol table from "/home/foo/c.out"? (y or n) Reading symbols from /home/foo/c.out...done. 43 | Breakpoint 1 at 0x40086d: file test-gdb.c, line 30. 44 | Starting program: /home/foo/c.out 45 | [Thread debugging using libthread_db enabled] 46 | Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 47 | 48 | Breakpoint 1, foo1 () at test-gdb.c:30 49 | warning: Source file is more recent than executable. 50 | 30 usleep(2500); 51 | 52 | Program received signal SIGTTIN, Stopped (tty input). 53 | foo1 () at test-gdb.c:30 54 | 30 usleep(2500); 55 | 31 exit(1); 56 | #0 foo1 () at test-gdb.c:31 57 | #1 0x00000000004008bd in main () at test-gdb.c:40 58 | The program being debugged has been started already. 59 | Start it from the beginning? (y or n) Program not restarted. 60 | Continuing. 61 | [Inferior 1 (process 10076) exited with code 01] 62 | quit 63 | -------------------------------------------------------------------------------- /tests/file.glslf: -------------------------------------------------------------------------------- 1 | #version 140 2 | varying vec4 color_out; 3 | /* 4 | A color shader 5 | */ 6 | void main(void) 7 | { 8 | // edit the color of the fragment 9 | vec4 new_color = color_out + vec4(0.4, 0.4, 0.1, 1.0); 10 | gl_FragColor = clamp(new_color, 0.0, 1.0); 11 | } 12 | -------------------------------------------------------------------------------- /tests/file.go: -------------------------------------------------------------------------------- 1 | // gtk-source-lang: Go 2 | /* comment! */ 3 | var s string := "A string\n" 4 | import ("fmt") 5 | func main() { fmt.Printf(s); } 6 | type my_struct struct { I int; o string } 7 | package foo 8 | bar( a int32, b string )(c float32 ){ c = 1.3 + float32(a - int32(len(b)) } 9 | 10 | 11 | 12 | 13 | 14 | 15 | package main 16 | 17 | import ( 18 | "flag" 19 | "fmt" 20 | "io/ioutil" 21 | "log" 22 | 23 | "github.com/sourcegraph/syntaxhighlight" 24 | ) 25 | 26 | func main() { 27 | flag.Parse() 28 | 29 | log.SetFlags(0) 30 | 31 | if flag.NArg() != 1 { 32 | log.Fatal("Must specify exactly 1 filename argument.") 33 | } 34 | 35 | input, err := ioutil.ReadFile(flag.Arg(0)) 36 | if err != nil { 37 | log.Fatal(err) 38 | } 39 | 40 | html, err := syntaxhighlight.AsHTML(input) 41 | if err != nil { 42 | log.Fatal(err) 43 | } 44 | 45 | fmt.Printf("%s", html) 46 | } 47 | 48 | main() 49 | 50 | 51 | 52 | 53 | 54 | package app 55 | 56 | import ( 57 | "encoding/json" 58 | "fmt" 59 | "net/http" 60 | "strings" 61 | 62 | "github.com/julienschmidt/httprouter" 63 | "github.com/rewardStyle/rs-identity-service/pkg/domain" 64 | "github.com/rewardStyle/rs-identity-service/pkg/models" 65 | ) 66 | 67 | var allowedTypes = map[string]bool{ 68 | "brand": true, 69 | } 70 | 71 | var allowedStatuses = map[string]bool{ 72 | "pending": true, 73 | "approved": true, 74 | "declined": true, 75 | } 76 | 77 | var allowedStates = map[string]bool{ 78 | "active": true, 79 | "deleted": true, 80 | } 81 | 82 | // Defining the Port for the App to Domain connection 83 | type AccountHandler interface { 84 | ListAccounts(response http.ResponseWriter, request *http.Request, params httprouter.Params) 85 | GetAccountByID(response http.ResponseWriter, request *http.Request, params httprouter.Params) 86 | CreateAccount(response http.ResponseWriter, request *http.Request, params httprouter.Params) 87 | } 88 | 89 | // Defining the Adapter that ties the port to the domain logic. 90 | type accountHandler struct { 91 | accountService domain.AccountService 92 | } 93 | 94 | func NewAccountHandler(accountService domain.AccountService) AccountHandler { 95 | return &accountHandler{ 96 | accountService, 97 | } 98 | } 99 | 100 | func (a *accountHandler) ListAccounts(response http.ResponseWriter, request *http.Request, params httprouter.Params) { 101 | 102 | // Retrieving context 103 | ctx := request.Context() 104 | 105 | // Do stuff at the domain level using the adapter. 106 | a.accountService.GetAllAccounts(ctx) 107 | } 108 | 109 | func (a *accountHandler) GetAccountByID(response http.ResponseWriter, request *http.Request, params httprouter.Params) { 110 | 111 | // Retrieving context 112 | ctx := request.Context() 113 | 114 | // Grabbing parameter id by name 115 | id := params.ByName("id") 116 | 117 | // Pass in parameter into domain layer 118 | account, err := a.accountService.GetAccountByID(ctx, id) 119 | 120 | // temp statement, just to remove go unused error 121 | fmt.Println(account) 122 | 123 | if err != nil { 124 | fmt.Println("Uh oh, error encountered!") 125 | } 126 | // Temp statements 127 | fmt.Println("Getting account by id ...\n") 128 | fmt.Println("ID: " + id) 129 | 130 | } 131 | 132 | func (a *accountHandler) CreateAccount(response http.ResponseWriter, request *http.Request, params httprouter.Params) { 133 | // Setting Content-Type 134 | response.Header().Set("Content-Type", "application/json") 135 | 136 | errors := Errors{} 137 | 138 | // Retrieving context 139 | ctx := request.Context() 140 | 141 | // Creating new input model 142 | input := models.NewCreateAccountInput() 143 | 144 | decoder := json.NewDecoder(request.Body) 145 | err := decoder.Decode(&input) 146 | 147 | if err != nil { 148 | errors.Messages = append(errors.Messages, "Unable to decode request body.") 149 | } 150 | 151 | // Ensure all corresponding input fields are lowercased 152 | input.Type = strings.ToLower(input.Type) 153 | input.State = strings.ToLower(input.State) 154 | input.Status = strings.ToLower(input.Status) 155 | 156 | ///////////////////////////// 157 | // Value error checking 158 | ///////////////////////////// 159 | 160 | // Checking required fields 161 | 162 | if input.Type == "" { 163 | errors.Messages = append(errors.Messages, "type is required.") 164 | } 165 | 166 | if input.Name == "" { 167 | errors.Messages = append(errors.Messages, "name is required.") 168 | } 169 | 170 | if allowedTypes[input.Type] != true { 171 | errors.Messages = append(errors.Messages, "Only the following types are allowed: "+strings.Join(GetKeysFromMap(allowedTypes), ", ")) 172 | } 173 | 174 | if allowedStates[input.State] != true { 175 | errors.Messages = append(errors.Messages, "Only the following states are allowed: "+strings.Join(GetKeysFromMap(allowedStates), ", ")) 176 | } 177 | 178 | if allowedStatuses[input.Status] != true { 179 | errors.Messages = append(errors.Messages, "Only the following statuses are allowed: "+strings.Join(GetKeysFromMap(allowedStatuses), ", ")) 180 | } 181 | 182 | if err != nil { 183 | fmt.Println(err) 184 | 185 | errors.Messages = append(errors.Messages, "Error receiving output struct!"+err.Error()) 186 | } 187 | 188 | // Initiate error response if any errors were caught during this function. 189 | if len(errors.Messages) > 0 { 190 | errors.StatusCode = 400 191 | response.WriteHeader(errors.StatusCode) 192 | 193 | jsonErrors, err := json.Marshal(errors) 194 | if err != nil { 195 | fmt.Println(err) 196 | return 197 | } 198 | 199 | response.Write(jsonErrors) 200 | 201 | return 202 | 203 | } 204 | 205 | // Pass input struct into domain expecting output struct 206 | output, err := a.accountService.CreateAccount(ctx, &input) 207 | 208 | wrapper := ResponseWrapper{ 209 | Data: output, 210 | } 211 | 212 | jsonBody, err := json.Marshal(wrapper) 213 | 214 | // Setting 201 created status 215 | response.WriteHeader(http.StatusCreated) 216 | response.Write(jsonBody) 217 | } 218 | 219 | 220 | 221 | package main 222 | 223 | import "fmt" 224 | 225 | func main() { 226 | /* local variable definition */ 227 | var a int = 100 228 | var b int = 200 229 | var ret int 230 | 231 | /* calling a function to get max value */ 232 | ret = max(a, b) 233 | 234 | fmt.Printf( "Max value is : %d\n", ret ) 235 | } 236 | 237 | /* function returning the max between two numbers */ 238 | func max(num1, num2 int) int { 239 | /* local variable declaration */ 240 | var result int 241 | 242 | if (num1 > num2) { 243 | result = num1 244 | } else { 245 | result = num2 246 | } 247 | return result 248 | } 249 | 250 | avg(6.56, 13.44) 251 | 252 | func (s *PostgresStore) CreateAccountTable(ctx context.Context) error { 253 | query := ` 254 | CREATE TABLE IF NOT EXISTS account ( 255 | id SERIAL PRIMARY KEY, 256 | first_name VARCHAR(255) NOT NULL, 257 | last_name VARCHAR(255) NOT NULL, 258 | account_number BIGINT UNIQUE NOT NULL, 259 | balance DECIMAL(18, 2) NOT NULL DEFAULT 0.00, 260 | created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP 261 | );` 262 | _, err := s.db.ExecContext(ctx, query) 263 | if err != nil { 264 | return err 265 | } 266 | return nil 267 | } 268 | 269 | package main 270 | 271 | import ( 272 | "context" 273 | "database/sql" 274 | "errors" 275 | "fmt" 276 | "log" 277 | "time" 278 | 279 | _ "github.com/lib/pq" // PostgreSQL driver 280 | ) 281 | 282 | // Employee represents the structure of an employee record 283 | // Using sql.Null* types for fields that can be NULL in the database 284 | type Employee struct { 285 | EmployeeID int64 286 | FirstName string 287 | LastName string 288 | Email sql.NullString // Handles NULL emails 289 | PhoneNumber sql.NullString // Handles NULL phone numbers 290 | HireDate time.Time 291 | JobTitle sql.NullString // Handles NULL job titles 292 | Salary sql.NullFloat64 // Handles NULL salaries 293 | ManagerID sql.NullInt64 // Handles NULL manager IDs (FK) 294 | DepartmentID sql.NullInt64 // Handles NULL department IDs (FK) 295 | IsActive bool 296 | ProfileNotes sql.NullString 297 | BonusPercentage sql.NullFloat64 298 | // ProfilePicture BLOB might be []byte, sql.NullBytes etc. 299 | } 300 | 301 | // DBTX is an interface defining methods common to *sql.DB and *sql.Tx 302 | // This allows functions to work with either a database connection pool or a transaction. 303 | type DBTX interface { 304 | QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row 305 | ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) 306 | // Add other methods like QueryContext if needed by other functions 307 | } 308 | 309 | // PostgresStore holds the database connection pool 310 | type PostgresStore struct { 311 | db *sql.DB 312 | } 313 | 314 | // NewPostgresStore creates a new store with a database connection 315 | func NewPostgresStore(connectionString string) (*PostgresStore, error) { 316 | db, err := sql.Open("postgres", connectionString) 317 | if err != nil { 318 | return nil, fmt.Errorf("failed to open database connection: %w", err) 319 | } 320 | 321 | // Verify connection is working 322 | if err := db.Ping(); err != nil { 323 | db.Close() // Close connection if ping fails 324 | return nil, fmt.Errorf("failed to ping database: %w", err) 325 | } 326 | 327 | // Configure connection pool settings (optional but recommended) 328 | db.SetMaxOpenConns(25) 329 | db.SetMaxIdleConns(10) 330 | db.SetConnMaxLifetime(5 * time.Minute) 331 | 332 | log.Println("Database connection established successfully.") 333 | return &PostgresStore{db: db}, nil 334 | } 335 | 336 | // Close closes the underlying database connection pool 337 | func (s *PostgresStore) Close() error { 338 | if s.db != nil { 339 | return s.db.Close() 340 | } 341 | return nil 342 | } 343 | 344 | // --- Robust Function Example --- 345 | 346 | // GetEmployeeByID retrieves a single employee record by their ID. 347 | // It uses the DBTX interface, making it usable with *sql.DB or *sql.Tx. 348 | func (s *PostgresStore) GetEmployeeByID(ctx context.Context, db DBTX, id int64) (*Employee, error) { 349 | // 1. Define the parameterized SQL query 350 | // Using $1, $2... placeholders for PostgreSQL. Use ? for MySQL/SQLite. 351 | query := ` 352 | SELECT 353 | employee_id, first_name, last_name, email, phone_number, hire_date, 354 | job_title, salary, manager_id, department_id, is_active, 355 | profile_notes, bonus_percentage 356 | FROM 357 | employees 358 | WHERE 359 | employee_id = $1;` 360 | 361 | // 2. Execute the query using QueryRowContext 362 | // QueryRowContext is preferred for fetching exactly one row. 363 | // It takes the context, query, and parameters. 364 | row := db.QueryRowContext(ctx, query, id) 365 | 366 | // 3. Prepare a variable to scan the result into 367 | var emp Employee 368 | 369 | // 4. Scan the row into the Employee struct fields 370 | // Use pointers to the struct fields. Match the order of columns in SELECT. 371 | // Use the correct sql.Null* types for nullable columns. 372 | err := row.Scan( 373 | &emp.EmployeeID, 374 | &emp.FirstName, 375 | &emp.LastName, 376 | &emp.Email, // Scan into sql.NullString 377 | &emp.PhoneNumber, // Scan into sql.NullString 378 | &emp.HireDate, 379 | &emp.JobTitle, // Scan into sql.NullString 380 | &emp.Salary, // Scan into sql.NullFloat64 381 | &emp.ManagerID, // Scan into sql.NullInt64 382 | &emp.DepartmentID, // Scan into sql.NullInt64 383 | &emp.IsActive, 384 | &emp.ProfileNotes, // Scan into sql.NullString 385 | &emp.BonusPercentage, // Scan into sql.NullFloat64 386 | ) 387 | 388 | // 5. Handle potential errors from Scan 389 | if err != nil { 390 | // Check for the specific "no rows found" error 391 | if errors.Is(err, sql.ErrNoRows) { 392 | // Return nil employee and a clear "not found" error (or just nil, nil) 393 | return nil, fmt.Errorf("employee with ID %d not found", id) 394 | } 395 | // For other errors (connection issues, data type mismatch, etc.), wrap the error 396 | // %w allows callers to use errors.Is or errors.As on the wrapped error. 397 | return nil, fmt.Errorf("failed to scan employee data for ID %d: %w", id, err) 398 | } 399 | 400 | // 6. Return the populated Employee struct and nil error on success 401 | return &emp, nil 402 | } 403 | 404 | // --- Example Usage --- 405 | 406 | func main() { 407 | // Replace with your actual PostgreSQL connection string 408 | // Format: "postgres://user:password@host:port/database?sslmode=disable" 409 | connStr := "postgres://user:password@localhost:5432/company_db?sslmode=disable" 410 | 411 | store, err := NewPostgresStore(connStr) 412 | if err != nil { 413 | log.Fatalf("Error creating store: %v", err) 414 | } 415 | defer store.Close() // Ensure the connection pool is closed when main exits 416 | 417 | // Create a context with a timeout 418 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) 419 | defer cancel() // Important to call cancel to release resources 420 | 421 | employeeIDToFind := int64(101) // Example ID 422 | 423 | // --- Usage with *sql.DB --- 424 | log.Printf("Attempting to fetch employee %d directly...", employeeIDToFind) 425 | employee, err := store.GetEmployeeByID(ctx, store.db, employeeIDToFind) // Pass store.db directly 426 | if err != nil { 427 | log.Printf("Error fetching employee: %v", err) 428 | } else { 429 | log.Printf("Found employee: %+v", *employee) 430 | // Access Nullable fields safely: 431 | if employee.Email.Valid { 432 | log.Printf("Employee Email: %s", employee.Email.String) 433 | } else { 434 | log.Println("Employee Email: NULL") 435 | } 436 | } 437 | 438 | // --- Usage within a Transaction (*sql.Tx) --- 439 | log.Println("\nAttempting fetch within a transaction...") 440 | tx, err := store.db.BeginTx(ctx, nil) // Start a transaction 441 | if err != nil { 442 | log.Fatalf("Failed to begin transaction: %v", err) 443 | } 444 | 445 | // Use 'defer tx.Rollback()' for safety in case of errors before Commit 446 | // This ensures the transaction is rolled back if something goes wrong. 447 | // It's a no-op if Commit() is called successfully first. 448 | defer tx.Rollback() 449 | 450 | employeeInTx, err := store.GetEmployeeByID(ctx, tx, employeeIDToFind) // Pass the transaction 'tx' 451 | if err != nil { 452 | log.Printf("Error fetching employee within transaction: %v", err) 453 | // Rollback will happen due to defer 454 | } else { 455 | log.Printf("Found employee within transaction: %+v", *employeeInTx) 456 | 457 | // Perform other operations within the same transaction... 458 | // e.g., update another table related to this employee 459 | // _, err = tx.ExecContext(ctx, "UPDATE some_other_table SET status='processed' WHERE emp_id = $1", employeeIDToFind) 460 | // if err != nil { ... handle error, rollback happens via defer ... } 461 | 462 | // If all operations succeed, commit the transaction 463 | if err := tx.Commit(); err != nil { 464 | log.Fatalf("Failed to commit transaction: %v", err) 465 | } else { 466 | log.Println("Transaction committed successfully.") 467 | } 468 | } 469 | } -------------------------------------------------------------------------------- /tests/file.groovy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env groovy 2 | 3 | // Single-line comment. TODO markers work. 4 | /* Multi-line comment. 5 | TODO markers work. */ 6 | 7 | 'line' \ 8 | + 'continuation' 9 | 10 | def tsq = '''Triple single-quoted string. 11 | 12 | Escapes work: \' \n \123 \u12ab \ 13 | Interpolation doesn't work: $x ${x} 14 | ''' 15 | 16 | def sq = 'Single-quoted string. Escapes work: \' \r \45 \u45CD \ 17 | Interpolation does not: $x ${x}' 18 | 19 | def tdq = """Triple double-quoted string. 20 | 21 | Escapes work: \" \f \6 \uABCD \ 22 | Interpolation works: $x._y.z0 ${x + 5} 23 | """ 24 | 25 | def dq = "Double-quoted string. Escapes work: \" \b \7 \u5678 \ 26 | So does interpolation: $_abc1 ${x + "abc"}" 27 | 28 | def slashy = /Slashy string. 29 | 30 | There are only two escape sequences: \/ \ 31 | Interpolation works: $X ${-> X} 32 | Dollars $ and backslashes \ on their own are interpreted literally./ 33 | 34 | def notSlashy = 1 /2/ 3 // not a slashy string; just two division operators 35 | 36 | def dollarSlashy = $/Dollar slashy string. 37 | 38 | There are three escape sequences: $$ $/ \ 39 | Interpolation works: $_ ${true} 40 | Dollars $ and backslashes \ on their own are interpreted literally./$ 41 | 42 | 0b10i + 0b0110_1011 // binary numbers 43 | 0 + 123L + 456_789 // decimal numbers 44 | 0xab + 0xcd_efG // hexadecimal numbers 45 | 46 | 01_23.45_67g + 1e-23f + 2d + 08.80 // floating-point numbers 47 | 48 | trait Test { 49 | void foo(List list) { 50 | def sum = 0 51 | for (n in list) sum += n as int 52 | println sum 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /tests/file.h: -------------------------------------------------------------------------------- 1 | /* A C header damn it */ 2 | #include 3 | #import 4 | 5 | @interface Lalala : Object 6 | - (void) sayHello; 7 | @end 8 | 9 | class Boo { 10 | void hello (); 11 | }; 12 | -------------------------------------------------------------------------------- /tests/file.hx: -------------------------------------------------------------------------------- 1 | /* Multi line comment 2 | * ================== 3 | * line 1 4 | * line 2 5 | * */ 6 | 7 | package; 8 | 9 | import flash.display.Sprite; 10 | 11 | class Main extends Sprite 12 | { 13 | var foo:Int = 400; // single line comment 14 | public static function main():Void 15 | { 16 | @metadata("argument") 17 | @:buildMacro 18 | var boolean:Bool = false; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/file.ijm: -------------------------------------------------------------------------------- 1 | // line comment 2 | var variable = "string\n with \t escaped\"characters"; 3 | macro "new macro" { 4 | NotGlobalVar = 5 +6; 5 | result = getPixel(0, 0); 6 | run("8-bit"); 7 | } 8 | function NewFunction() { 9 | /* 10 | multiline comment*/ 11 | } 12 | -------------------------------------------------------------------------------- /tests/file.impl: -------------------------------------------------------------------------------- 1 | -- Opal test 2 | IMPLEMENTATION LeapYear 3 | 4 | IMPORT Nat COMPLETELY 5 | 6 | DEF leapYear(year) == 7 | IF (year % ("400"!) = 0) THEN true 8 | IF (year % ("400"!) |= 0) and (year % 100 = 0) THEN false 9 | IF (year % 100 |= 0) and (year % 4 = 0) THEN true 10 | IF (year % 4 |= 0) THEN false 11 | FI 12 | -------------------------------------------------------------------------------- /tests/file.ini: -------------------------------------------------------------------------------- 1 | [module] 2 | type=Python 3 | file=simple.py 4 | version=1.0 5 | [plugin] 6 | id=APlugin 7 | _name=A Plugin 8 | _description=A plugin 9 | author=Some Guy 10 | ; this is a plugin version, can be anything 11 | version=3.1415926 12 | -------------------------------------------------------------------------------- /tests/file.json: -------------------------------------------------------------------------------- 1 | { 2 | "syntax_highlighting_test_file": { 3 | "description": "A comprehensive JSON file to test syntax highlighting.", 4 | "version": 1.2, 5 | "valid_json_spec": true, 6 | "comment_note": "Standard JSON spec does not support comments (like // or /* */). They are included here ONLY for theme highlighting testing.", 7 | "string_types": { 8 | "simple_string": "Hello, World!", 9 | "string_with_escapes": "Quotes \" and backslash \\ and forward slash \/. Newline\n Tab\t Backspace\b Formfeed\f CarriageReturn\r.", 10 | "string_with_unicode": "Unicode characters: Sigma \u03A3, Copyright \u00A9, Emoji Face \uD83D\uDE00 (requires surrogate pair)", 11 | "string_with_numbers": "12345", 12 | "empty_string": "", 13 | "long_string": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." 14 | }, 15 | "number_types": { 16 | "integer": 1234567890, 17 | "negative_integer": -987, 18 | "zero": 0, 19 | "floating_point": 3.1415926535, 20 | "negative_float": -0.001, 21 | "exponent_positive": 1.23e10, 22 | "exponent_negative": 9.87e-5, 23 | "large_number": 999999999999999999999 24 | }, 25 | "boolean_types": { 26 | "literal_true": true, 27 | "literal_false": false 28 | }, 29 | "null_type": { 30 | "literal_null": null 31 | }, 32 | "array_types": { 33 | "simple_number_array": [1, 2, 3, 10, 100], 34 | "simple_string_array": ["apple", "banana", "cherry"], 35 | "simple_boolean_array": [true, false, true], 36 | "array_of_nulls": [null, null], 37 | "mixed_type_array": [ 38 | "string", 39 | 42, 40 | true, 41 | null, 42 | { "nested_key": "nested_value" }, 43 | [10, 20] 44 | ], 45 | "array_of_arrays": [ 46 | [1, 2], 47 | [3, 4], 48 | [5, 6] 49 | ], 50 | "array_of_objects": [ 51 | { "id": 1, "status": "active" }, 52 | { "id": 2, "status": "inactive", "reason": null }, 53 | { "id": 3, "status": "pending", "tags": ["urgent", "review"] } 54 | ], 55 | "empty_array": [] 56 | }, 57 | "object_types": { 58 | "simple_object": { 59 | "key1": "value1", 60 | "key2": 100 61 | }, 62 | "nested_object": { 63 | "level1": { 64 | "message": "Level 1 reached", 65 | "level2": { 66 | "enabled": true, 67 | "data": [null, null, null] 68 | } 69 | } 70 | }, 71 | "object_with_special_key_names": { 72 | "key with spaces": "Value for key with spaces", 73 | "key-with-hyphens": 123, 74 | "key_with_underscores": true, 75 | "key.with.dots": null, 76 | "123key_starts_with_number": "Valid JSON key", 77 | "$key_with_symbols%": "Also valid", 78 | "": "Empty string key" 79 | }, 80 | "empty_object": {} 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /tests/file.jsx: -------------------------------------------------------------------------------- 1 | // A simple function component that returns JSX 2 | function Greeting(props) { 3 | // A variable that holds a JSX expression 4 | const name = {props.name} 5 | // A JSX element that uses the variable and a prop 6 | return ( 7 |

    8 | Hello, {name}! You are {props.age} years old. 9 |

    10 | ) 11 | } 12 | 13 | // A class component that renders the function component 14 | class App extends React.Component { 15 | render() { 16 | // A JSX fragment that contains two instances of the function component 17 | return ( 18 | <> 19 | 20 | 21 | 22 | ) 23 | } 24 | } 25 | 26 | // Rendering the class component using JSX 27 | ReactDOM.render(, document.getElementById('root')) 28 | 29 | // A custom component that takes props 30 | function Card(props) { 31 | return ( 32 |
    33 |

    {props.title}

    34 |

    {props.description}

    35 |
    36 | ) 37 | } 38 | 39 | // A component that uses the spread operator to pass props 40 | function App() { 41 | // An object that contains props 42 | const cardProps = { 43 | title: 'JSX', 44 | description: 'JSX is awesome!', 45 | } 46 | // Passing the props using the spread operator 47 | return 48 | } 49 | 50 | // A component that uses conditional rendering 51 | function Greeting(props) { 52 | // A variable that holds a JSX expression 53 | const message = props.isLoggedIn ? ( 54 |

    Welcome back, {props.name}!

    // Using ternary operator 55 | ) : ( 56 |

    Please log in.

    57 | ) 58 | // A JSX element that uses the variable 59 | return
    {message}
    60 | } 61 | 62 | // A component that uses map() to render a list 63 | function List(props) { 64 | // A variable that holds an array of JSX elements 65 | const items = props.items.map( 66 | (item) =>
  • {item.name}
  • , // Using keys to identify items 67 | ) 68 | // A JSX element that uses the variable 69 | return
      {items}
    70 | } 71 | -------------------------------------------------------------------------------- /tests/file.la: -------------------------------------------------------------------------------- 1 | # moo.la - a libtool library file 2 | # Generated by ltmain.sh - GNU libtool 1.5.22 Debian 1.5.22-4 (1.1220.2.365 2005/12/18 22:14:06) 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='moo.so' 9 | 10 | # Names of this library. 11 | library_names='moo.so moo.so moo.so' 12 | 13 | # The name of the static archive. 14 | old_library='' 15 | 16 | # Libraries that this one depends upon. 17 | dependency_libs=' -L/usr/local/gtk/lib /home/muntyan/projects/gtk/build/moo/moo/libmoo.la -lutil /usr/local/gtk/lib/libgtk-x11-2.0.la -lXext -lXinerama -lXrandr -lXcursor -lXfixes /usr/local/gtk/lib/libgdk-x11-2.0.la -latk-1.0 /usr/local/gtk/lib/libgdk_pixbuf-2.0.la /usr/local/gtk/lib/libpangocairo-1.0.la /usr/local/gtk/lib/libpangoft2-1.0.la /usr/local/gtk/lib/libpango-1.0.la /usr/local/gtk/lib/libcairo.la -lfreetype -lz -lfontconfig -lpng12 -lXrender -lX11 -lm /usr/local/gtk/lib/libgobject-2.0.la /usr/local/gtk/lib/libgmodule-2.0.la -ldl /usr/local/gtk/lib/libgthread-2.0.la -lpthread /usr/local/gtk/lib/libglib-2.0.la -lrt -lpcre /usr/lib/gcc/i486-linux-gnu/4.1.2/../../..//libfam.la -lrpcsvc /usr/lib/gcc/i486-linux-gnu/4.1.2/../../..//libxml2.la -L/usr/lib/python2.4 -lpython2.4 ' 18 | 19 | # Version information for moo. 20 | current=0 21 | age=0 22 | revision=0 23 | 24 | # Is this an already installed library? 25 | installed=no 26 | 27 | # Should we warn about portability when linking against -modules? 28 | shouldnotlink=yes 29 | 30 | # Files to dlopen/dlpreopen 31 | dlopen='' 32 | dlpreopen='' 33 | 34 | # Directory that this library needs to be installed in: 35 | libdir='/usr/local/gtk/lib/python2.4/site-packages' 36 | relink_command="(cd /home/muntyan/projects/gtk/build/moo/moo; /bin/sh ../libtool --tag=CC --mode=relink gcc -g -L/usr/local/gtk/lib -o moo.la -rpath /usr/local/gtk/lib/python2.4/site-packages -no-undefined -module -avoid-version -export-symbols-regex initmoo moopython/libmoomod.la libmoo.la -lutil -L/usr/local/gtk/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -pthread -L/usr/local/gtk/lib -lgthread-2.0 -lglib-2.0 -lpcre -lfam -lxml2 -L/usr/lib/python2.4 -lpython2.4 @inst_prefix_dir@)" 37 | -------------------------------------------------------------------------------- /tests/file.ll: -------------------------------------------------------------------------------- 1 | ; LLVM intermediate representation 2 | ; Run with: llc file.ll && gcc file.s && ./a.out 3 | 4 | @str = internal constant [4 x i8] c"%d\0A\00" 5 | 6 | declare i32 @printf(i8*, ...) 7 | 8 | define i32 @main() { 9 | ; Print a secret number on the screen 10 | %1 = select i1 true, float 0x402ABD70A0000000, float 0xC0FFEE0000000000 11 | %2 = fpext float %1 to double 12 | %3 = fmul double %2, 1.000000e+02 13 | %4 = fptoui double %3 to i32 14 | %5 = add i32 %4, 1 15 | ; Call printf 16 | call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @str, i32 0, i32 0), i32 %5) 17 | ret i32 0 18 | } 19 | -------------------------------------------------------------------------------- /tests/file.logcat: -------------------------------------------------------------------------------- 1 | --------- beginning of /dev/log/system 2 | V/test ( 145): The quick brown fox jumps over the lazy dog 3 | D/test ( 141): The quick brown fox jumps over the lazy dog 4 | I/test ( 141): The quick brown fox jumps over the lazy dog 5 | W/test ( 141): The quick brown fox jumps over the lazy dog 6 | E/test ( 141): The quick brown fox jumps over the lazy dog 7 | F/test ( 141): The quick brown fox jumps over the lazy dog 8 | --------- beginning of /dev/log/system 9 | V(test ( 145): The quick brown fox jumps over the lazy dog 10 | D(test ( 141): The quick brown fox jumps over the lazy dog 11 | I(test ( 141): The quick brown fox jumps over the lazy dog 12 | W(test ( 141): The quick brown fox jumps over the lazy dog 13 | E(test ( 141): The quick brown fox jumps over the lazy dog 14 | F(test ( 141): The quick brown fox jumps over the lazy dog 15 | --------- beginning of /dev/log/main 16 | 01-28 12:36:22.826 8 8 V TEST : "The quick brown fox jumps over the lazy dog" 17 | 01-28 12:36:22.826 98 98 D TEST : "The quick brown fox jumps over the lazy dog" 18 | 01-28 12:36:22.826 398 398 I TEST : "The quick brown fox jumps over the lazy dog" 19 | 01-28 12:36:22.826 3398 3398 W TEST : "The quick brown fox jumps over the lazy dog" 20 | 01-28 12:36:22.827 3398 3398 E TEST : "The quick brown fox jumps over the lazy dog" 21 | 01-28 12:36:22.827 3398 3398 F TEST : "The quick brown fox jumps over the lazy dog" 22 | 2017-01-28 12:36:22.826 8 8 V TEST : "The quick brown fox jumps over the lazy dog" 23 | 2017-01-28 12:36:22.826 98 98 D TEST : "The quick brown fox jumps over the lazy dog" 24 | 2017-01-28 12:36:22.826 398 398 I TEST : "The quick brown fox jumps over the lazy dog" 25 | 2017-01-28 12:36:22.826 3398 3398 W TEST : "The quick brown fox jumps over the lazy dog" 26 | 2017-01-28 12:36:22.827 3398 3398 E TEST : "The quick brown fox jumps over the lazy dog" 27 | 2017-01-28 12:36:22.827 3398 3398 F TEST : "The quick brown fox jumps over the lazy dog" 28 | -------------------------------------------------------------------------------- /tests/file.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | @interface Lalala : Object 4 | - (BOOL) sayHello; 5 | @end 6 | 7 | @implementation Lalala : Object 8 | - (BOOL) sayHello 9 | { 10 | printf ("Hello there!\n"); 11 | return YES; 12 | } 13 | @end 14 | 15 | int main (void) 16 | { 17 | Lalala *obj = [[Lalala alloc] init]; 18 | [obj sayHello]; 19 | [obj free]; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /tests/file.m4: -------------------------------------------------------------------------------- 1 | dnl an m4 file 2 | AC_DEFINE([foo],[echo "Hi there!"]) 3 | AC_CHECK_FUNC([foo],[yes=yes],[yes=no]) 4 | foo() 5 | -------------------------------------------------------------------------------- /tests/file.md: -------------------------------------------------------------------------------- 1 | 2 | __Advertisement :)__ 3 | 4 | - __[pica](https://nodeca.github.io/pica/demo/)__ 5 | - high quality and fast image resize in browser. 6 | 7 | - __[babelfish](https://github.com/nodeca/babelfish/)__ 8 | - developer friendly i18n with plurals support and easy syntax. 9 | 10 | - .sdfsdfsdfsdf sdfsdfsdfs 11 | 12 | 1. maoma 13 | 2. fasdf 14 | 3. adasfsd 15 | > sdasda 16 | >> dasdasdas 17 | 18 | * sdasda lkasd 19 | * asdkj fskdljf sd 20 | 21 | You will like those projects! 22 | 23 | --- 24 | sdfaasdf 25 | --- 26 | 27 | # h1 Heading 8-) 28 | ## h2 Heading 29 | ### h3 Heading 30 | #### h4 Heading 31 | ##### h5 Heading 32 | ###### h6 Heading 33 | 34 | 35 | ## Horizontal Rules 36 | 37 | ___ 38 | --- 39 | *** 40 | 41 | 42 | ## Typographic replacements 43 | 44 | Enable typographer option to see result. 45 | 46 | (c) (C) (r) (R) (tm) (TM) (p) (P) +- 47 | 48 | test.. test... test..... test?..... test!.... 49 | 50 | !!!!!! ???? ,, -- --- 51 | 52 | "Smartypants, double quotes" and 'single quotes' 53 | 54 | 55 | ## Emphasis 56 | 57 | **This is bold text** 58 | 59 | __This is bold text__ 60 | 61 | *This is italic text* 62 | 63 | _This is italic text_ 64 | 65 | ~~Strikethrough~~ 66 | 67 | 68 | ## Blockquotes 69 | 70 | > Blockquotes can also be nested... 71 | >> ...by using additional greater-than signs right next to each other... 72 | > > > ...or with spaces between arrows. 73 | 74 | ## Lists 75 | 76 | Unordered 77 | 78 | + Create a list by starting a line with `+`, `-`, or `*` 79 | + Sub-lists are made by indenting 2 spaces: 80 | - Marker character change forces new list start: 81 | * Ac tristique libero volutpat at 82 | + Facilisis in pretium nisl aliquet 83 | - Nulla volutpat aliquam velit 84 | + Very easy! 85 | 86 | Ordered 87 | 88 | 1. Lorem ipsum dolor sit amet 89 | 2. Consectetur adipiscing elit 90 | 3. Integer molestie lorem at massa 91 | 92 | 93 | 1. You can use sequential numbers... 94 | 1. ...or keep all the numbers as `1.` 95 | 96 | Start numbering with offset: 97 | 98 | 57. foo 99 | 1. bar 100 | 101 | 102 | ## Code 103 | 104 | Inline `code` 105 | 106 | Indented code 107 | 108 | // Some comments 109 | line 1 of code 110 | line 2 of code 111 | line 3 of code 112 | 113 | 114 | Block code "fences" 115 | 116 | ``` 117 | Sample text here... 118 | ``` 119 | 120 | Syntax highlighting 121 | 122 | ``` js 123 | var foo = function (bar) { 124 | return bar++; 125 | }; 126 | 127 | console.log(foo(5)); 128 | ``` 129 | 130 | ## Tables 131 | 132 | | Option | Description | 133 | | ------ | ----------- | 134 | | data | path to data files to supply the data that will be passed into templates. | 135 | | engine | engine to be used for processing templates. Handlebars is the default. | 136 | | ext | extension to be used for dest files. | 137 | 138 | Right aligned columns 139 | 140 | | Option | Description | 141 | | ------:| -----------:| 142 | | data | path to data files to supply the data that will be passed into templates. | 143 | | engine | engine to be used for processing templates. Handlebars is the default. | 144 | | ext | extension to be used for dest files. | 145 | 146 | 147 | ## Links 148 | 149 | [link text](http://dev.nodeca.com) 150 | 151 | [link with title](http://nodeca.github.io/pica/demo/ "title text!") 152 | 153 | Autoconverted link https://github.com/nodeca/pica (enable linkify to see) 154 | 155 | 156 | ## Images 157 | 158 | ![Minion](https://octodex.github.com/images/minion.png) 159 | ![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat") 160 | 161 | Like links, Images also have a footnote style syntax 162 | 163 | ![Alt text][id] 164 | 165 | With a reference later in the document defining the URL location: 166 | 167 | [id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat" 168 | 169 | 170 | ## Plugins 171 | 172 | The killer feature of `markdown-it` is very effective support of 173 | [syntax plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin). 174 | 175 | 176 | ### [Emojies](https://github.com/markdown-it/markdown-it-emoji) 177 | 178 | > Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum: 179 | > 180 | > Shortcuts (emoticons): :-) :-( 8-) ;) 181 | 182 | see [how to change output](https://github.com/markdown-it/markdown-it-emoji#change-output) with twemoji. 183 | 184 | 185 | ### [Subscript](https://github.com/markdown-it/markdown-it-sub) / [Superscript](https://github.com/markdown-it/markdown-it-sup) 186 | 187 | - 19^th^ 188 | - H~2~O 189 | 190 | 191 | ### [\](https://github.com/markdown-it/markdown-it-ins) 192 | 193 | ++Inserted text++ 194 | 195 | 196 | ### [\](https://github.com/markdown-it/markdown-it-mark) 197 | 198 | ==Marked text== 199 | 200 | 201 | ### [Footnotes](https://github.com/markdown-it/markdown-it-footnote) 202 | 203 | Footnote 1 link[^first]. 204 | 205 | Footnote 2 link[^second]. 206 | 207 | Inline footnote^[Text of inline footnote] definition. 208 | 209 | Duplicated footnote reference[^second]. 210 | 211 | [^first]: Footnote **can have markup** 212 | 213 | and multiple paragraphs. 214 | 215 | [^second]: Footnote text. 216 | 217 | 218 | ### [Definition lists](https://github.com/markdown-it/markdown-it-deflist) 219 | 220 | Term 1 221 | 222 | : Definition 1 223 | with lazy continuation. 224 | 225 | Term 2 with *inline markup* 226 | 227 | : Definition 2 228 | 229 | { some code, part of Definition 2 } 230 | 231 | Third paragraph of definition 2. 232 | 233 | _Compact style:_ 234 | 235 | Term 1 236 | ~ Definition 1 237 | 238 | Term 2 239 | ~ Definition 2a 240 | ~ Definition 2b 241 | 242 | 243 | ### [Abbreviations](https://github.com/markdown-it/markdown-it-abbr) 244 | 245 | This is HTML abbreviation example. 246 | 247 | It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on. 248 | 249 | *[HTML]: Hyper Text Markup Language 250 | 251 | ### [Custom containers](https://github.com/markdown-it/markdown-it-container) 252 | 253 | ::: warning 254 | *here be dragons* 255 | ::: 256 | -------------------------------------------------------------------------------- /tests/file.ml: -------------------------------------------------------------------------------- 1 | open List 2 | 3 | (*comment 4 | (** comment in comment *) 5 | *) 6 | 7 | let id = fun x -> x 8 | 9 | (**) (*<- empty comment*) 10 | (**ocamldoc (*and comment*) *) 11 | 12 | let _ = print_string "ok\n" 13 | 14 | -------------------------------------------------------------------------------- /tests/file.octave: -------------------------------------------------------------------------------- 1 | % gtk-source-lang: octave 2 | % -*- octave -*- 3 | No idea what syntax is 4 | -------------------------------------------------------------------------------- /tests/file.ooc: -------------------------------------------------------------------------------- 1 | import structs/[ArrayList, LinkedList], io/FileReader 2 | include stdarg, memory, string 3 | use sdl, gtk 4 | pi := const 3.14 5 | Int: cover from int { 6 | toString: func -> String { "%d" format() } 7 | } 8 | Dog: class extends Animal { 9 | barf: func { ("woof! " * 2) println() } 10 | } 11 | -------------------------------------------------------------------------------- /tests/file.pc: -------------------------------------------------------------------------------- 1 | # A comment 2 | prefix=/usr 3 | exec_prefix= 4 | libdir=/lib 5 | includedir=/include 6 | 7 | Name: cairo 8 | Description: Multi-platform 2D graphics library 9 | Version: 1.4.10 10 | 11 | Requires.private: freetype2 >= 8.0.2 fontconfig libpng12 xrender >= 0.6 x11 12 | Libs: -L -lcairo 13 | Libs.private: -lz -lm 14 | Cflags: -I/cairo 15 | -------------------------------------------------------------------------------- /tests/file.pig: -------------------------------------------------------------------------------- 1 | /* 2 | * This file tests Apache Pig 0.12 Syntax Highlighting 3 | */ 4 | 5 | fake = LOAD 'fakeData' USING PigStorage() AS (name:chararray, age:int); 6 | 7 | fake = limit fake 5; -- operations can be case insensitive 8 | 9 | fake = FOREACH fake GENERATE TRIM(name) AS name, null as nullField, false AS booleanConst; 10 | 11 | DUMP fake; 12 | -------------------------------------------------------------------------------- /tests/file.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -- # -*- Perl -*- 2 | # 3 | # : collateindex.pl,v 1.10 2004/10/24 17:05:41 petere78 Exp $ 4 | 5 | print OUT "\n\n" if ; 6 | 7 | = {}; # the last indexterm we processed 8 | = 1; # this is the first one 9 | = ""; # we're not in a group yet 10 | = ""; # we've not put anything out yet 11 | @seealsos = (); # See also stack. 12 | 13 | # Termcount is > 0 iff some entries were skipped. 14 | || print STDERR " entries ignored...\n"; 15 | 16 | &end_entry(); 17 | 18 | print OUT "\n" if ; 19 | print OUT "\n"; 20 | 21 | close (OUT); 22 | 23 | || print STDERR "Done.\n"; 24 | 25 | sub same { 26 | my() = shift; 27 | my() = shift; 28 | 29 | my() = ->{'psortas'} || ->{'primary'}; 30 | my() = ->{'ssortas'} || ->{'secondary'}; 31 | my() = ->{'tsortas'} || ->{'tertiary'}; 32 | 33 | my() = ->{'psortas'} || ->{'primary'}; 34 | my() = ->{'ssortas'} || ->{'secondary'}; 35 | my() = ->{'tsortas'} || ->{'tertiary'}; 36 | 37 | my(); 38 | 39 | =~ s/^\s*//; =~ s/\s*$//; = uc(); 40 | =~ s/^\s*//; =~ s/\s*$//; = uc(); 41 | =~ s/^\s*//; =~ s/\s*$//; = uc(); 42 | =~ s/^\s*//; =~ s/\s*$//; = uc(); 43 | =~ s/^\s*//; =~ s/\s*$//; = uc(); 44 | =~ s/^\s*//; =~ s/\s*$//; = uc(); 45 | 46 | # print "[]=[]\n"; 47 | # print "[]=[]\n"; 48 | # print "[]=[]\n"; 49 | 50 | # Two index terms are the same if: 51 | # 1. the primary, secondary, and tertiary entries are the same 52 | # (or have the same SORTAS) 53 | # AND 54 | # 2. They occur in the same titled section 55 | # AND 56 | # 3. They point to the same place 57 | # 58 | # Notes: Scope is used to suppress some entries, but can't be used 59 | # for comparing duplicates. 60 | # Interpretation of "the same place" depends on whether or 61 | # not is true. 62 | 63 | = (( eq ) 64 | && ( eq ) 65 | && ( eq ) 66 | && (->{'title'} eq ->{'title'}) 67 | && (->{'href'} eq ->{'href'})); 68 | 69 | # If we're linking to points, they're only the same if they link 70 | # to exactly the same spot. 71 | = && (->{'hrefpoint'} eq ->{'hrefpoint'}) 72 | if ; 73 | 74 | if () { 75 | warn ": duplicated index entry found: \n"; 76 | } 77 | 78 | ; 79 | } 80 | 81 | sub tsame { 82 | # Unlike same(), tsame only compares a single term 83 | my() = shift; 84 | my() = shift; 85 | my() = shift; 86 | my() = substr(, 0, 1) . "sortas"; 87 | my(, ); 88 | 89 | = ->{} || ->{}; 90 | = ->{} || ->{}; 91 | 92 | =~ s/^\s*//; =~ s/\s*$//; = uc(); 93 | =~ s/^\s*//; =~ s/\s*$//; = uc(); 94 | 95 | return eq ; 96 | } 97 | 98 | =head1 EXAMPLE 99 | B B<-o> F F 100 | =head1 EXIT STATUS 101 | =over 5 102 | =item B<0> 103 | Success 104 | =item B<1> 105 | Failure 106 | =back 107 | =head1 AUTHOR 108 | Norm Walsh Endw@nwalsh.comE 109 | Minor updates by Adam Di Carlo Eadam@onshore.comE and Peter Eisentraut Epeter_e@gmx.netE 110 | =cut 111 | -------------------------------------------------------------------------------- /tests/file.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: PACKAGE VERSION\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2006-12-17 09:49-0600\n" 11 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 12 | "Last-Translator: FULL NAME \n" 13 | "Language-Team: LANGUAGE \n" 14 | "MIME-Version: 1.0\n" 15 | "Content-Type: text/plain; charset=CHARSET\n" 16 | "Content-Transfer-Encoding: 8bit\n" 17 | 18 | #: ../medit/medit.desktop.in.h:1 19 | msgid "Text editor" 20 | msgstr "" 21 | 22 | #: ../medit/medit.desktop.in.h:2 23 | msgid "medit" 24 | msgstr "" 25 | -------------------------------------------------------------------------------- /tests/file.prg: -------------------------------------------------------------------------------- 1 | import "mod_say" 2 | import "mod_rand" 3 | import "mod_screen" 4 | import "mod_video" 5 | import "mod_map" 6 | import "mod_key" 7 | 8 | // Bouncing box example 9 | process main() 10 | private 11 | int vx=5, vy=5; 12 | 13 | begin 14 | set_mode(640, 480, 16, MODE_WINDOW); 15 | graph = map_new(20, 20, 16); 16 | map_clear(0, graph, rgb(255, 0, 0)); 17 | x = 320; y = 240; 18 | while(! key(_esc)) 19 | if(x > 630 || x < 10) 20 | vx = -vx; 21 | end; 22 | if(y > 470 || y < 10) 23 | vy = -vy; 24 | end; 25 | x += vx; y += vy; // Move the box 26 | frame; 27 | end; 28 | end; 29 | -------------------------------------------------------------------------------- /tests/file.prolog: -------------------------------------------------------------------------------- 1 | conc([],X,X). 2 | conc([Car|Cdr], X, [Car|ConcatCdr]):- 3 | conc(Cdr, X, ConcatCdr). 4 | -------------------------------------------------------------------------------- /tests/file.pug: -------------------------------------------------------------------------------- 1 | //- Pug Syntax Highlighting Test File 2 | //- This file demonstrates various Pug features for theme testing. 3 | //- Note: This requires a Pug compiler to render to HTML, but is used here 4 | //- purely for testing syntax highlighting in VS Code. 5 | 6 | // --- JavaScript Variables (Defined for use in the template) --- 7 | - var pageTitle = "Pug Syntax Test & Examples"; 8 | - var user = { name: "Alice", id: 123, isAdmin: true, description: "

    User Bio

    " }; 9 | - var items = ["Apple", "Banana", "Cherry"]; 10 | - var chapters = { 'ch1': 'Introduction', 'ch2': 'Core Concepts', 'ch3': 'Advanced Topics' }; 11 | - var isActive = true; 12 | - var maybeDisabled = false; 13 | - var count = 5; 14 | - var rawHtmlSnippet = "Raw HTML using != operator"; 15 | - var imagePath = "/images/logo.png"; 16 | - var customClasses = ['btn', 'btn-large', 'btn-primary']; 17 | - var conditionalClasses = { 'active-feature': user.isAdmin, 'guest-user': !user.isAdmin }; 18 | - var styleObject = { color: 'blue', 'font-size': '16px', border: '1px solid #ccc' }; //- Style object 19 | 20 | // --- Doctype --- 21 | doctype html 22 | 23 | // --- Basic Structure & Attributes --- 24 | html(lang="en", data-version="1.0") 25 | 26 | // --- Head Section --- 27 | head 28 | meta(charset="UTF-8") 29 | meta(name="viewport", content="width=device-width, initial-scale=1.0") 30 | //- Title with interpolation 31 | title= pageTitle + " | Pug Test" 32 | //- Linking CSS and Scripts 33 | link(rel="stylesheet", href="/css/style.css") 34 | script(src="/js/script.js", async) 35 | //- Embedded CSS using filter 36 | style. 37 | /* Embedded CSS Test */ 38 | body { font-family: sans-serif; } 39 | .special { color: purple; } 40 | //- Embedded JS using filter 41 | script 42 | :javascript 43 | // Embedded JS Test 44 | console.log('Pug embedded JS filter executed.'); 45 | function testFunc(msg) { alert('Message: ' + msg); } 46 | 47 | // --- Body Section --- 48 | body#page-body.theme-light(class=customClasses, class=conditionalClasses, data-user-id="user-" + user.id) 49 | 50 | // --- Comments --- 51 | // This is a Pug comment (won't appear in HTML output) 52 | //- This is also a hidden Pug comment (buffered) 53 | 54 | // 55 | This is an HTML comment. 56 | It will appear in the HTML output. 57 | It spans multiple lines. 58 | 59 | //if IE 9 60 | p This is an IE conditional comment. 61 | 62 | // --- Tags, IDs, Classes --- 63 | header#main-header.site-header(role="banner") 64 | //- Implicit div tag with ID and classes 65 | #logo.logo-container 66 | //- Boolean attribute (true value) 67 | img(src=imagePath, alt=`Logo for ${pageTitle}`, data-loaded=true) 68 | nav.main-navigation.navbar.navbar-expand 69 | ul.nav-list 70 | li.nav-item: a(href="/home") Home // Implicit nested tag with colon 71 | li.nav-item.active: a(href="/about") About 72 | 73 | main#content.container(aria-live="polite") 74 | 75 | // --- Text Content & Interpolation --- 76 | h1 Hello, #{user.name}! // Escaped interpolation 77 | //- Unescaped interpolation 78 | p!= "Welcome! Your description: " + user.description 79 | p Raw HTML Snippet: != rawHtmlSnippet 80 | 81 | //- Inline text 82 | p This paragraph has inline text directly after the tag. 83 | 84 | //- Piped text (multi-line block) 85 | p 86 | | This text block uses pipes. 87 | | Each line starts with a pipe character. 88 | | It allows for longer content easily. 89 | br //- Self-closing tag example 90 | | Another line after a break. 91 | 92 | //- Plain text block using dot notation 93 | div.plain-text-block 94 | . 95 | This text block uses a dot. 96 | It is treated as plain text without pipes. 97 | Indentation matters here too. 98 | 99 | //- Block Expansion 100 | a(href="#"): strong Clickable Text: Showing block expansion. 101 | 102 | // --- Attributes --- 103 | section(data-section-name='attributes-test') 104 | h2 Attribute Examples 105 | //- Standard string attributes (single and double quotes) 106 | a(href='http://example.com', title="Example Link") Example Site 107 | //- JavaScript expression in attribute 108 | p(data-user-level=(user.isAdmin ? 'admin' : 'standard')) User Level 109 | //- Boolean attributes (true/false/null expression) 110 | input(type="checkbox", name="active", checked=isActive) 111 | input(type="text", name="maybe", disabled=maybeDisabled, readonly=null) //- null/false disables 112 | //- Style attribute from object 113 | div(style=styleObject) Styled Div 114 | //- Class attribute from array/object (merged with existing if any) 115 | button.base-btn(type="button", class=customClasses, class=conditionalClasses) Merged Classes Button 116 | //- Unescaped attribute value 117 | div(data-unsafe-html!=rawHtmlSnippet) 118 | 119 | // --- Code (Unbuffered, Buffered, Unescaped) --- 120 | section#code-examples 121 | h2 Code Examples 122 | //- Unbuffered code (for logic) 123 | - var calculatedValue = count * 10; 124 | - var statusMessage = user.isAdmin ? "Administrator" : "Regular User"; 125 | //- Buffered code (output escaped) 126 | p Calculated Value: #{calculatedValue} 127 | p Status: = statusMessage 128 | //- Unescaped buffered code (output raw) 129 | div!= user.description 130 | 131 | // --- Control Flow --- 132 | section#control-flow 133 | h2 Control Flow 134 | //- If / Else If / Else 135 | if user.isAdmin 136 | p.status.admin Welcome, Admin! 137 | else if user.name === "Alice" 138 | p.status.special Welcome back, Alice! 139 | else 140 | p.status.guest Welcome, Guest! 141 | 142 | //- Unless (opposite of if) 143 | unless maybeDisabled 144 | p This section is NOT disabled. 145 | 146 | //- Each loop (Array) 147 | h3 Item List 148 | ul.item-list 149 | each item, index in items 150 | li(class=`item-${index}`) Item #{index + 1}: #{item} 151 | else 152 | li No items in the list. 153 | 154 | //- Each loop (Object) 155 | h3 Chapters 156 | dl.chapter-list 157 | each title, key in chapters 158 | dt Chapter: #{key} 159 | dd Title: #{title} 160 | else 161 | p No chapters available. 162 | 163 | //- While loop 164 | h3 While Loop 165 | - var i = 0; 166 | ul 167 | while i < count 168 | li Iteration #{i++} // Use JS increment within interpolation 169 | //- Need to manually increment i if not done above 170 | //- - i++; 171 | 172 | // --- Mixins --- 173 | section#mixins 174 | h2 Mixins 175 | 176 | //- Mixin Definition: Simple 177 | mixin simpleMessage 178 | p.mixin-message This is a simple mixin message. 179 | 180 | //- Mixin Definition: With arguments & defaults 181 | mixin userCard(name, role='User', score=0) 182 | .user-card 183 | h4= name 184 | p Role: #{role} 185 | if score > 0 186 | p Score: #{score} 187 | 188 | //- Mixin Definition: With block content 189 | mixin panel(title) 190 | .panel 191 | .panel-heading= title 192 | .panel-body 193 | if block 194 | block // Yields to the block passed when calling 195 | else 196 | p.empty-panel No content provided for this panel. 197 | 198 | //- Mixin Definition: Using &attributes 199 | mixin iconButton(iconName, ...args) // Rest arguments 200 | button.icon-btn&attributes(attributes) 201 | i(class=`icon-${iconName}`) 202 | span= args.join(' ') // Example using rest args 203 | 204 | //- Mixin Usage 205 | +simpleMessage 206 | 207 | +userCard(user.name, user.isAdmin ? 'Admin' : 'User', 75) 208 | +userCard('Bob') // Using default role and score 209 | 210 | +panel('Important Information') 211 | p This is content passed into the panel mixin's block. 212 | ul 213 | li Point 1 214 | li Point 2 215 | 216 | +panel('Empty Panel') // Calling mixin without a block 217 | 218 | +iconButton('save', 'Save', 'Changes')(class="btn-save", type="submit", id="save-btn") // Passing attributes 219 | 220 | 221 | // --- Includes and Extends (Example Syntax - assumes files exist) --- 222 | section#includes-extends 223 | h2 Includes & Extends (Syntax Examples) 224 | //- include partials/header.pug // Include another Pug file 225 | //- include ../data/content.md // Include plain text/markdown 226 | 227 | //- Extends example (usually at the top of the file) 228 | //- extends layouts/base.pug 229 | 230 | //- Block definition/overriding (used with extends) 231 | //- block content 232 | //- p This content replaces the 'content' block in layouts/base.pug 233 | 234 | //- append footerScripts 235 | //- script(src="/js/page-specific.js") 236 | 237 | //- prepend pageStyles 238 | //- link(rel="stylesheet", href="/css/page-specific.css") 239 | 240 | 241 | // --- Filters --- 242 | section#filters 243 | h2 Filters 244 | //- Markdown Filter (requires markdown-it or similar) 245 | :markdown 246 | ## Markdown Filter 247 | This text will be rendered as **Markdown**. 248 | * Item 1 249 | * Item 2 250 | [Link](http://example.com) 251 | 252 | //- CoffeeScript Filter (example - requires CoffeeScript compiler) 253 | //- :coffeescript 254 | //- console.log "Hello from CoffeeScript!" 255 | //- square = (x) -> x * x 256 | 257 | //- CDATA Filter 258 | :cdata 259 | John Doe 260 | CDATA sections are treated as raw text blocks in XML/HTML. 261 | 262 | 263 | // --- Case Statement --- 264 | section#case-statement 265 | h2 Case Statement 266 | - var userRole = user.isAdmin ? 'admin' : 'guest'; 267 | case userRole 268 | when 'admin' 269 | p Welcome, powerful administrator! 270 | when 'editor' 271 | p You have editing privileges. 272 | when 'guest' 273 | p Welcome, guest user. Please sign in. 274 | default 275 | p Unknown user role. 276 | 277 | // --- Footer --- 278 | footer.site-footer 279 | p © #{new Date().getFullYear()} #{pageTitle}. All rights reserved. // Using JS Date object 280 | //- Escaped attribute example for security context 281 | a(href=`/profile?id=${user.id}`, title=`View profile for ${user.name}`) Profile Link -------------------------------------------------------------------------------- /tests/file.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Python Syntax Highlighting Test File 4 | 5 | This file includes a variety of Python constructs to test 6 | syntax highlighting in code editors and themes. 7 | """ 8 | 9 | # --- Imports --- 10 | import os 11 | import sys 12 | from collections import defaultdict, namedtuple 13 | import asyncio as aio # Import with alias 14 | from math import * # Wildcard import (generally discouraged but syntactically valid) 15 | 16 | # --- Constants and Globals --- 17 | GLOBAL_CONSTANT = "This is a global constant" 18 | DEBUG_MODE: bool = True 19 | MAX_RETRIES = 5 20 | PI = 3.14159 21 | COMPLEX_NUMBER = 2 + 3j 22 | HEX_VALUE = 0xFF 23 | OCT_VALUE = 0o77 24 | BIN_VALUE = 0b1011 25 | 26 | # --- Comments --- 27 | # This is a single-line comment. 28 | # TODO: Add more features later. 29 | # FIXME: Fix this bug. 30 | # NOTE: Remember this detail. 31 | 32 | """ 33 | This is a multi-line 34 | docstring often used for modules, classes, or functions. 35 | It can span multiple lines. 36 | """ 37 | 38 | # --- Basic Data Types and Literals --- 39 | integer_var = 12345 40 | float_var = 123.45 41 | scientific_notation = 1.23e4 42 | string_var_single = 'Hello, World!' 43 | string_var_double = "Python's syntax is flexible." 44 | multi_line_string = """ 45 | This string spans 46 | multiple lines using triple quotes. 47 | """ 48 | raw_string = r"C:\Users\Name\Documents" 49 | byte_string = b"This is a byte string" 50 | f_string = f"The value of PI is approximately {PI:.2f}. Hex: {HEX_VALUE:#x}" 51 | boolean_true = True 52 | boolean_false = False 53 | none_value = None 54 | 55 | # --- Data Structures --- 56 | my_list: list[int] = [1, 2, 3, 4, 5] 57 | my_tuple: tuple[str, int] = ('a', 1) 58 | my_set: set[float] = {1.0, 2.5, 3.0, 2.5} # Duplicates ignored 59 | my_dict: dict[str, int] = { 60 | "key1": 100, 61 | "key2": 200, 62 | "another key": 300, 63 | } 64 | 65 | # Accessing elements 66 | first_item = my_list[0] 67 | dict_value = my_dict["key1"] 68 | 69 | # Comprehensions 70 | list_comp = [x * x for x in range(10) if x % 2 == 0] 71 | set_comp = {char for char in "programming"} 72 | dict_comp = {i: chr(65 + i) for i in range(5)} 73 | generator_exp = (x + 1 for x in my_list) # Generator expression 74 | 75 | # --- Control Flow --- 76 | if DEBUG_MODE is True and MAX_RETRIES > 0: 77 | print("Debugging is ON") 78 | elif not DEBUG_MODE: 79 | print("Debugging is OFF") 80 | else: 81 | print("Retries exhausted") 82 | 83 | # For loop 84 | for i, item in enumerate(my_list): 85 | if i % 2 == 0: 86 | print(f"Even index {i}: {item}") 87 | else: 88 | continue # Skip odd indices 89 | if item > 4: 90 | print("Found item > 4, breaking loop.") 91 | break 92 | else: 93 | # Executed if the loop completes without break 94 | print("Loop finished normally.") 95 | 96 | # While loop 97 | count = 0 98 | while count < 3: 99 | print(f"While loop count: {count}") 100 | count += 1 101 | 102 | # --- Functions --- 103 | def greet(name: str, greeting: str = "Hello") -> str: 104 | """Greets a person. Demonstrates type hints and default args.""" 105 | message = f"{greeting}, {name}!" 106 | return message 107 | 108 | def process_data(*args: int, **kwargs: str) -> None: 109 | """Demonstrates *args and **kwargs.""" 110 | print("Positional args:", args) 111 | print("Keyword args:", kwargs) 112 | # Using a global variable (use with caution) 113 | global GLOBAL_CONSTANT 114 | GLOBAL_CONSTANT = "Modified global" 115 | # nonlocal example (nested function) 116 | outer_var = 10 117 | def inner_func(): 118 | nonlocal outer_var 119 | outer_var += 5 120 | print("Inner func outer_var:", outer_var) 121 | inner_func() 122 | 123 | 124 | # Function call 125 | greeting_message = greet("Alice") 126 | greet(name="Bob", greeting="Hi") # Keyword arguments 127 | process_data(1, 2, 3, key="value", mode="test") 128 | 129 | # Lambda function 130 | adder = lambda x, y: x + y 131 | result = adder(5, 3) 132 | 133 | # Generator function 134 | def count_up_to(n): 135 | i = 1 136 | while i <= n: 137 | yield i 138 | i += 1 139 | 140 | counter_gen = count_up_to(3) 141 | for num in counter_gen: 142 | print(f"Generated: {num}") 143 | 144 | 145 | # --- Classes --- 146 | class Vehicle: 147 | """A base class for vehicles.""" 148 | # Class variable 149 | num_vehicles = 0 150 | 151 | def __init__(self, make: str, model: str, year: int) -> None: 152 | self.make = make 153 | self.model = model 154 | self.year = year 155 | Vehicle.num_vehicles += 1 156 | 157 | def display_info(self) -> str: 158 | """Returns basic vehicle info.""" 159 | return f"{self.year} {self.make} {self.model}" 160 | 161 | @classmethod 162 | def get_vehicle_count(cls) -> int: 163 | """Returns the total number of vehicles created.""" 164 | return cls.num_vehicles 165 | 166 | @staticmethod 167 | def is_vintage(year: int) -> bool: 168 | """Checks if a year is considered vintage.""" 169 | return year < 1990 170 | 171 | # Inheritance 172 | class Car(Vehicle): 173 | """A car class inheriting from Vehicle.""" 174 | def __init__(self, make: str, model: str, year: int, num_doors: int) -> None: 175 | super().__init__(make, model, year) # Call parent constructor 176 | self.num_doors = num_doors 177 | self._protected_attr = "Protected" # Convention for protected 178 | self.__private_attr = "Private" # Name mangling 179 | 180 | def display_info(self) -> str: 181 | """Overrides the parent method.""" 182 | base_info = super().display_info() 183 | return f"{base_info}, {self.num_doors} doors" 184 | 185 | def honk(self) -> None: 186 | """A car-specific method.""" 187 | print("Beep beep!") 188 | 189 | # Instantiation and method calls 190 | my_car = Car("Toyota", "Camry", 2023, 4) 191 | print(my_car.display_info()) 192 | my_car.honk() 193 | print(f"Is vintage? {Car.is_vintage(my_car.year)}") 194 | print(f"Total vehicles: {Vehicle.get_vehicle_count()}") 195 | # Accessing protected/private (demonstration, not recommended) 196 | print(my_car._protected_attr) 197 | # print(my_car.__private_attr) # This would cause an AttributeError 198 | print(my_car._Car__private_attr) # Access via name mangling 199 | 200 | # --- Decorators --- 201 | def simple_decorator(func): 202 | """A simple function decorator.""" 203 | def wrapper(*args, **kwargs): 204 | print(f"Calling {func.__name__}...") 205 | result = func(*args, **kwargs) 206 | print(f"{func.__name__} finished.") 207 | return result 208 | return wrapper 209 | 210 | @simple_decorator 211 | def decorated_function(x): 212 | print(f"Executing decorated function with arg: {x}") 213 | return x * 2 214 | 215 | decorated_function(10) 216 | 217 | # --- Exception Handling --- 218 | try: 219 | risky_value = my_list[10] # This will raise IndexError 220 | division_result = 10 / 0 # This will raise ZeroDivisionError 221 | except IndexError as e: 222 | print(f"Caught an IndexError: {e}") 223 | except ZeroDivisionError: 224 | print("Caught a ZeroDivisionError: Cannot divide by zero.") 225 | except Exception as e: # Catch any other exceptions 226 | print(f"Caught unexpected exception: {type(e).__name__} - {e}") 227 | else: 228 | # Executed if no exceptions were raised in the try block 229 | print("No exceptions occurred.") 230 | finally: 231 | # Always executed, regardless of exceptions 232 | print("Finished exception handling block.") 233 | 234 | # Raising an exception 235 | # raise ValueError("This is a custom value error!") 236 | 237 | # Assertions 238 | assert DEBUG_MODE is True, "Debug mode should be enabled" 239 | # assert 1 == 2, "This assertion will fail" 240 | 241 | # --- Context Managers (with statement) --- 242 | try: 243 | with open("non_existent_file.txt", "r") as f: 244 | content = f.read() 245 | except FileNotFoundError: 246 | print("Caught FileNotFoundError using 'with open'.") 247 | 248 | # --- Asynchronous Programming (async/await) --- 249 | # Note: Running this requires an async event loop (e.g., using asyncio.run()) 250 | async def async_task(name: str, delay: float) -> str: 251 | """Simulates an async task.""" 252 | print(f"Task {name}: Starting...") 253 | await aio.sleep(delay) # Use await for async operations 254 | print(f"Task {name}: Finished after {delay}s") 255 | return f"Result from {name}" 256 | 257 | async def main_async(): 258 | """Main async function to run tasks.""" 259 | task1 = async_task("A", 1) 260 | task2 = async_task("B", 0.5) 261 | results = await aio.gather(task1, task2) # Run tasks concurrently 262 | print("Async results:", results) 263 | 264 | # To run the async part: 265 | # if __name__ == "__main__": 266 | # aio.run(main_async()) 267 | # print("Finished async execution.") 268 | 269 | 270 | # --- Operators --- 271 | # Arithmetic 272 | add = 5 + 3 273 | sub = 10 - 4 274 | mul = 6 * 7 275 | div = 10 / 4 # Float division 276 | floor_div = 10 // 4 # Integer division 277 | mod = 10 % 3 278 | power = 2 ** 8 279 | 280 | # Comparison 281 | eq = (5 == 5) 282 | neq = (5 != 6) 283 | lt = (4 < 5) 284 | gt = (6 > 5) 285 | lte = (5 <= 5) 286 | gte = (6 >= 5) 287 | 288 | # Logical 289 | and_op = (True and False) 290 | or_op = (True or False) 291 | not_op = (not True) 292 | 293 | # Bitwise 294 | bit_and = 0b1010 & 0b1100 # 8 (0b1000) 295 | bit_or = 0b1010 | 0b1100 # 14 (0b1110) 296 | bit_xor = 0b1010 ^ 0b1100 # 6 (0b0110) 297 | bit_not = ~0b1010 # -11 298 | left_shift = 0b101 << 1 # 10 (0b1010) 299 | right_shift = 0b1010 >> 1 # 5 (0b101) 300 | 301 | # Assignment 302 | x = 10 303 | x += 5 # x is now 15 304 | x -= 3 # x is now 12 305 | x *= 2 # x is now 24 306 | x /= 6 # x is now 4.0 307 | x //= 3 # x is now 1.0 308 | x **= 3 # x is now 1.0 309 | x %= 2 # x is now 1.0 (modulo) 310 | 311 | # Identity 312 | a = [1, 2] 313 | b = [1, 2] 314 | c = a 315 | is_op = (a is c) # True 316 | is_not_op = (a is not b) # True (different objects) 317 | 318 | # Membership 319 | in_op = (1 in my_list) # True 320 | not_in_op = ('z' not in "hello") # True 321 | 322 | # Walrus operator (Assignment Expressions) - Python 3.8+ 323 | # if (n := len(my_list)) > 3: 324 | # print(f"List is long ({n} elements)") 325 | 326 | # --- Built-in Functions and Types --- 327 | length = len(my_list) 328 | type_info = type(my_car) 329 | int_conversion = int("123") 330 | str_conversion = str(123.45) 331 | is_instance = isinstance(my_car, Vehicle) 332 | callable_check = callable(greet) 333 | 334 | # --- Miscellaneous --- 335 | # Using pass as a placeholder 336 | def placeholder_function(): 337 | pass # Do nothing 338 | 339 | # Deleting a variable 340 | temp_var = "delete me" 341 | print(f"Before del: {temp_var}") 342 | del temp_var 343 | # print(temp_var) # NameError: name 'temp_var' is not defined 344 | 345 | 346 | print("\n--- End of Syntax Test ---") -------------------------------------------------------------------------------- /tests/file.rq: -------------------------------------------------------------------------------- 1 | # Positive test: product of type promotion within the xsd:decimal type tree. 2 | 3 | PREFIX t: 4 | PREFIX rdf: 5 | PREFIX xsd: 6 | ASK 7 | WHERE { t:double1 rdf:value ?l . 8 | t:float1 rdf:value ?r . 9 | FILTER ( datatype(?l + ?r) = xsd:double ) } 10 | -------------------------------------------------------------------------------- /tests/file.rst: -------------------------------------------------------------------------------- 1 | Heading 2 | ======= 3 | 4 | These are some addresses: http://www.gnome.org/ and https://www.gnome.org/ and git://git.gnome.org/gtksourceview and ssh://USERNAME@git.gnome.org/git/gtksourceview and gnome-list@gnome.org is the last one. 5 | 6 | Subheading 7 | ---------- 8 | 9 | - First ``literal`` Item 10 | - Second **bold** Item 11 | - Subitem `interpreted` 12 | - Third *emphasis* Item 13 | 14 | This is a sentence with a `http-link `_, a `https-link `_, and a footnote [#]_. 15 | 16 | .. image:: images/example.png 17 | :height: 100px 18 | :width: 100 px 19 | 20 | | A line block 21 | > A quote block 22 | 23 | .. 24 | 25 | This is a block that will be shown. 26 | 27 | .. This is a comment and will not be shown. 28 | 29 | .. math:: 30 | 31 | \lambda = \lambda_{0} + \arctan \left[ \frac{x}{-y} \right] 32 | -------------------------------------------------------------------------------- /tests/file.sci: -------------------------------------------------------------------------------- 1 | // A comment with whites and tabulations 2 | // Scilab editor: http://www.scilab.org/ 3 | 4 | function [a, b] = myfunction(d, e, f) 5 | a = 2.71828 + %pi + f($, :); 6 | b = cos(a) + cosh(a); 7 | if d == e then 8 | b = 10 - e.field; 9 | else 10 | b = " test " + home 11 | return 12 | end 13 | myvar = 1.23e-45; 14 | endfunction 15 | -------------------------------------------------------------------------------- /tests/file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Hi there!" 3 | 4 | # Parameter Expansion 5 | 6 | xxx${xxx}xxx # parameter in braces 7 | xxx${"{"}xxx xxx${"}"}xxx # brace in quoted string 8 | 9 | xxx$0000 # one digit parameter 10 | 11 | xxx${parameter:-word}xxx${parameter-word}xxx # Use Default Values 12 | xxx${parameter:=word}xxx${parameter=word}xxx # Assign Default Values 13 | xxx${parameter:?word}xxx${parameter?word}xxx # Indicate Error if Null or Unset 14 | xxx${parameter:?}xxx${parameter?}xxx # Indicate Error if Null or Unset 15 | xxx${parameter:+word}xxx${parameter+word}xxx # Use Alternative Value 16 | 17 | xxx${#parameter}xxx # String Length 18 | xxx${parameter%word}xxx # Remove Smallest Suffix Pattern 19 | xxx${parameter%%word}xxx # Remove Largest Suffix Pattern 20 | xxx${parameter#word}xxx # Remove Smallest Prefix Pattern 21 | xxx${parameter##word}xxx # Remove Largest Prefix Pattern 22 | 23 | xxx${x:-$(ls)}xxx 24 | xxx${posix:?}xxx 25 | xxx${3:+posix}xxx 26 | xxx${#HOME}xxx 27 | xxx${x%.c}.oxxx 28 | xxx${x#$HOME}xxx 29 | xxx${x##*/}xxx 30 | xxx${x#*}xxx 31 | xxx${x#"*"}xxx 32 | -------------------------------------------------------------------------------- /tests/file.spec: -------------------------------------------------------------------------------- 1 | # 2 | # gtksourceview.spec 3 | # 4 | 5 | %define api_version 1.0 6 | %define lib_major 0 7 | %define lib_name %mklibname %{name}- %{api_version} %{lib_major} 8 | 9 | Summary: Source code viewing library 10 | Name: gtksourceview 11 | Version: 1.7.2 12 | Release: %mkrel 1 13 | License: GPL 14 | Group: Editors 15 | URL: http://people.ecsc.co.uk/~matt/downloads/rpms/gtksourceview/ 16 | Source0: https://download.gnome.org/sources/%{name}/%{name}-%{version}.tar.xz 17 | BuildRoot: %{_tmppath}/%{name}-%{version} 18 | BuildRequires: libgtk+2-devel >= 2.3.0 19 | BuildRequires: libgnome-vfs2-devel >= 2.2.0 20 | BuildRequires: libgnomeprintui-devel >= 2.7.0 21 | BuildRequires: perl-XML-Parser 22 | Conflicts: gtksourceview-sharp <= 0.5-3mdk 23 | 24 | %description 25 | GtkSourceview is a library that adds syntax highlighting, 26 | line numbers, and other programming-editor features. 27 | GtkSourceView specializes these features for a code editor. 28 | 29 | %package -n %{lib_name} 30 | Summary: Source code viewing library 31 | Group: Editors 32 | Requires: %{name} >= %{version}-%{release} 33 | Provides: lib%{name} = %{version}-%{release} 34 | Provides: libgtksourceview0 = %{version}-%{release} 35 | Obsoletes: libgtksourceview0 36 | Provides: libgtksourceview1.0 = %{version}-%{release} 37 | Obsoletes: libgtksourceview1.0 38 | 39 | %description -n %{lib_name} 40 | GtkSourceview is a library that adds syntax highlighting, 41 | line numbers, and other programming-editor features. 42 | GtkSourceView specializes these features for a code editor. 43 | 44 | %package -n %{lib_name}-devel 45 | Summary: Libraries and include files for GtkSourceView 46 | Group: Development/GNOME and GTK+ 47 | Requires: %{lib_name} = %{version} 48 | Provides: %{name}-devel = %{version}-%{release} 49 | Provides: lib%{name}-devel = %{version}-%{release} 50 | Provides: lib%{name}-%{api_version}-devel = %{version}-%{release} 51 | Provides: libgtksourceview0-devel = %{version}-%{release} 52 | Obsoletes: libgtksourceview0-devel 53 | Provides: libgtksourceview1.0-devel = %{version}-%{release} 54 | Obsoletes: libgtksourceview1.0-devel 55 | 56 | %description -n %{lib_name}-devel 57 | GtkSourceView development files 58 | 59 | 60 | %prep 61 | %setup -q 62 | 63 | %build 64 | 65 | %configure2_5x 66 | 67 | %make 68 | 69 | %install 70 | rm -rf %{buildroot} 71 | 72 | %makeinstall_std 73 | 74 | %{find_lang} %{name}-%{api_version} 75 | 76 | %post -n %{lib_name} -p /sbin/ldconfig 77 | 78 | %postun -n %{lib_name} -p /sbin/ldconfig 79 | 80 | %clean 81 | rm -rf %{buildroot} 82 | 83 | %files -f %{name}-%{api_version}.lang 84 | %defattr(-,root,root) 85 | %doc AUTHORS ChangeLog NEWS README TODO 86 | %{_datadir}/gtksourceview-%{api_version} 87 | 88 | %files -n %{lib_name} 89 | %defattr(-,root,root) 90 | %{_libdir}/*.so.* 91 | 92 | %files -n %{lib_name}-devel 93 | %defattr(-,root,root) 94 | %doc %{_datadir}/gtk-doc/html/gtksourceview 95 | %{_libdir}/*.so 96 | %attr(644,root,root) %{_libdir}/*.la 97 | %{_includedir}/* 98 | %{_libdir}/pkgconfig/* 99 | 100 | %changelog 101 | * Tue Aug 08 2006 Götz Waschk 1.7.2-1mdv2007.0 102 | - New release 1.7.2 103 | 104 | * Tue Jul 25 2006 Götz Waschk 1.7.1-1mdk 105 | - New release 1.7.1 106 | -------------------------------------------------------------------------------- /tests/file.sql: -------------------------------------------------------------------------------- 1 | -- ============================================================================= 2 | -- SQL Syntax Highlighting Showcase 3 | -- Purpose: Demonstrate various SQL syntax elements for editor theme testing. 4 | -- Note: This script may require adjustments for specific database systems. 5 | -- ============================================================================= 6 | 7 | -- Single line comment 8 | 9 | /* 10 | Multi-line comment block. 11 | Covering DDL, DML, TCL, DCL, Functions, Procedures, Triggers, etc. 12 | */ 13 | 14 | -- ============================================================================= 15 | -- Data Definition Language (DDL) 16 | -- ============================================================================= 17 | 18 | -- Schema definition (Optional, depends on DB system) 19 | CREATE SCHEMA IF NOT EXISTS company_schema; 20 | -- USE company_schema; -- Might be needed depending on the SQL client/system 21 | 22 | -- Table Creation with various data types and constraints 23 | CREATE TABLE departments ( 24 | department_id INTEGER PRIMARY KEY, -- Or SERIAL, AUTO_INCREMENT depending on DB 25 | department_name VARCHAR(100) NOT NULL UNIQUE, 26 | location VARCHAR(50) DEFAULT 'Head Office', 27 | budget DECIMAL(12, 2) CHECK (budget > 0), 28 | established_date DATE 29 | ); 30 | 31 | CREATE TABLE employees ( 32 | employee_id INTEGER PRIMARY KEY, -- Or INT IDENTITY(1,1) etc. 33 | first_name VARCHAR(50) NOT NULL, 34 | last_name VARCHAR(50) NOT NULL, 35 | email VARCHAR(100) UNIQUE, 36 | phone_number VARCHAR(20), 37 | hire_date TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- Or NOW() 38 | job_title VARCHAR(50), 39 | salary DECIMAL(10, 2), 40 | manager_id INTEGER REFERENCES employees(employee_id), -- Self-referencing FK 41 | department_id INTEGER, 42 | is_active BOOLEAN DEFAULT TRUE, 43 | profile_notes TEXT, -- Large text block 44 | profile_picture BLOB, -- Binary Large Object (syntax may vary) 45 | CONSTRAINT fk_department FOREIGN KEY (department_id) REFERENCES departments(department_id) ON DELETE SET NULL, 46 | CONSTRAINT chk_email CHECK (email LIKE '%@%.%') -- Basic email format check 47 | ); 48 | 49 | CREATE TABLE projects ( 50 | project_id INTEGER PRIMARY KEY, 51 | project_name VARCHAR(100) NOT NULL, 52 | start_date DATE, 53 | end_date DATE, 54 | CONSTRAINT chk_dates CHECK (end_date IS NULL OR end_date >= start_date) 55 | ); 56 | 57 | -- Junction table for many-to-many relationship 58 | CREATE TABLE employee_projects ( 59 | assignment_id INTEGER PRIMARY KEY, -- Or generated always as identity 60 | employee_id INTEGER NOT NULL REFERENCES employees(employee_id) ON DELETE CASCADE, 61 | project_id INTEGER NOT NULL REFERENCES projects(project_id) ON DELETE CASCADE, 62 | assigned_date DATE DEFAULT CURRENT_DATE, -- Or GETDATE(), etc. 63 | role_in_project VARCHAR(50), 64 | UNIQUE (employee_id, project_id) -- Ensure employee isn't assigned twice to same project 65 | ); 66 | 67 | 68 | 69 | -- Index Creation 70 | CREATE INDEX idx_employee_name ON employees (last_name, first_name); 71 | CREATE UNIQUE INDEX idx_project_name ON projects (project_name); 72 | 73 | -- View Creation 74 | CREATE VIEW employee_department_view AS 75 | SELECT 76 | e.employee_id, 77 | e.first_name || ' ' || e.last_name AS full_name, -- String concatenation (syntax varies: + , CONCAT()) 78 | e.job_title, 79 | d.department_name, 80 | d.location 81 | FROM 82 | employees e 83 | LEFT JOIN 84 | departments d ON e.department_id = d.department_id; 85 | 86 | -- Altering Tables 87 | ALTER TABLE employees 88 | ADD COLUMN bonus_percentage FLOAT DEFAULT 0.0; 89 | 90 | ALTER TABLE employees 91 | ALTER COLUMN phone_number TYPE VARCHAR(25); -- Syntax varies: MODIFY COLUMN, etc. 92 | 93 | ALTER TABLE departments 94 | DROP COLUMN established_date; 95 | 96 | ALTER TABLE projects 97 | ADD CONSTRAINT uq_project_dates UNIQUE (project_name, start_date); 98 | 99 | -- Sequence creation (Syntax highly variable) 100 | -- CREATE SEQUENCE employee_id_seq START WITH 100 INCREMENT BY 1; 101 | 102 | -- ============================================================================= 103 | -- Data Manipulation Language (DML) 104 | -- ============================================================================= 105 | 106 | -- Inserting Data 107 | INSERT INTO departments (department_id, department_name, budget, location) VALUES 108 | (1, 'Technology', 500000.00, 'Building A'), 109 | (2, 'Human Resources', 150000.00, 'Building B'), 110 | (3, 'Sales', 300000.00, DEFAULT); -- Using default value 111 | 112 | -- Multi-row insert 113 | INSERT INTO employees (employee_id, first_name, last_name, email, job_title, salary, department_id, hire_date, manager_id) VALUES 114 | (101, 'Alice', 'Smith', 'alice.s@example.com', 'Software Engineer', 90000.00, 1, '2023-01-15 09:00:00', NULL), 115 | (102, 'Bob', 'Johnson', 'bob.j@example.com', 'HR Manager', 75000.00, 2, '2022-11-01 10:30:00', NULL), 116 | (103, 'Charlie', 'Brown', 'charlie.b@example.com', 'Sales Representative', 60000.00, 3, '2023-03-10 11:00:00', NULL), 117 | (104, 'Diana', 'Ross', 'diana.r@example.com', 'Senior Software Engineer', 110000.00, 1, '2022-08-20 08:45:00', 101); 118 | 119 | INSERT INTO projects (project_id, project_name, start_date, end_date) VALUES 120 | (1, 'Alpha Initiative', '2023-02-01', '2024-01-31'), 121 | (2, 'Beta Platform', '2023-05-15', NULL), 122 | (3, 'Gamma Sales Push', '2023-04-01', '2023-09-30'); 123 | 124 | INSERT INTO employee_projects (assignment_id, employee_id, project_id, role_in_project) VALUES 125 | (1, 101, 1, 'Lead Developer'), 126 | (2, 101, 2, 'Architect'), 127 | (3, 104, 1, 'Developer'), 128 | (4, 103, 3, 'Coordinator'); 129 | 130 | -- Updating Data 131 | UPDATE employees 132 | SET salary = salary * 1.05, bonus_percentage = 0.05 133 | WHERE department_id = 1 AND hire_date < '2023-01-01'; 134 | 135 | UPDATE projects 136 | SET end_date = CURRENT_DATE 137 | WHERE project_name = 'Gamma Sales Push' AND end_date IS NULL; 138 | 139 | -- Deleting Data 140 | DELETE FROM employees 141 | WHERE employee_id = 103 AND is_active = FALSE; -- Assuming is_active was set to false elsewhere 142 | 143 | DELETE FROM departments 144 | WHERE department_id NOT IN (SELECT DISTINCT department_id FROM employees WHERE department_id IS NOT NULL); 145 | 146 | -- ============================================================================= 147 | -- SELECT Queries (Showcasing various clauses and features) 148 | -- ============================================================================= 149 | 150 | -- Basic Select 151 | SELECT employee_id, first_name, last_name, salary FROM employees; 152 | 153 | -- Select with Alias and WHERE clause 154 | SELECT 155 | e.first_name AS "First Name", -- Quoted identifier alias 156 | e.last_name AS LastName, -- Unquoted identifier alias 157 | e.salary * 12 AS AnnualSalary 158 | FROM 159 | employees e 160 | WHERE 161 | e.department_id = 1 162 | AND (e.salary > 100000 OR e.job_title LIKE '%Senior%') 163 | AND e.hire_date BETWEEN '2022-01-01' AND '2023-12-31' 164 | ORDER BY 165 | e.last_name ASC, e.first_name ASC; 166 | 167 | -- Joins (INNER, LEFT, RIGHT, FULL OUTER) 168 | SELECT 169 | e.first_name, 170 | d.department_name, 171 | p.project_name, 172 | ep.role_in_project 173 | FROM 174 | employees e 175 | INNER JOIN 176 | departments d ON e.department_id = d.department_id 177 | LEFT JOIN 178 | employee_projects ep ON e.employee_id = ep.employee_id 179 | LEFT JOIN 180 | projects p ON ep.project_id = p.project_id 181 | WHERE 182 | d.location = 'Building A'; 183 | 184 | -- Aggregation with GROUP BY and HAVING 185 | SELECT 186 | d.department_name, 187 | COUNT(e.employee_id) AS number_of_employees, 188 | AVG(e.salary) AS average_salary, 189 | MAX(e.hire_date) AS latest_hire_date 190 | FROM 191 | departments d 192 | JOIN 193 | employees e ON d.department_id = e.department_id 194 | GROUP BY 195 | d.department_name 196 | HAVING 197 | COUNT(e.employee_id) > 0 198 | AND AVG(e.salary) > 70000.00 199 | ORDER BY 200 | average_salary DESC; 201 | 202 | -- Subqueries (Scalar, IN, EXISTS) 203 | SELECT 204 | first_name, 205 | last_name 206 | FROM 207 | employees 208 | WHERE 209 | department_id = (SELECT department_id FROM departments WHERE department_name = 'Technology'); 210 | 211 | SELECT * FROM projects 212 | WHERE project_id IN (SELECT project_id FROM employee_projects WHERE employee_id = 101); 213 | 214 | SELECT d.department_name 215 | FROM departments d 216 | WHERE EXISTS (SELECT 1 FROM employees e WHERE e.department_id = d.department_id AND e.salary > 100000); 217 | 218 | -- Common Table Expressions (CTE) 219 | WITH DepartmentSalaries AS ( 220 | SELECT 221 | department_id, 222 | SUM(salary) as total_salary_cost 223 | FROM employees 224 | WHERE salary IS NOT NULL 225 | GROUP BY department_id 226 | ) 227 | SELECT 228 | d.department_name, 229 | ds.total_salary_cost 230 | FROM 231 | departments d 232 | JOIN 233 | DepartmentSalaries ds ON d.department_id = ds.department_id 234 | WHERE ds.total_salary_cost > 150000; 235 | 236 | -- Recursive CTE (Example: Employee Hierarchy) 237 | WITH RECURSIVE EmployeeHierarchy (employee_id, full_name, manager_id, level) AS ( 238 | -- Anchor member: employees with no manager (top level) 239 | SELECT employee_id, first_name || ' ' || last_name, manager_id, 0 240 | FROM employees 241 | WHERE manager_id IS NULL 242 | UNION ALL 243 | -- Recursive member: employees whose manager is already in the hierarchy 244 | SELECT e.employee_id, e.first_name || ' ' || e.last_name, e.manager_id, eh.level + 1 245 | FROM employees e 246 | INNER JOIN EmployeeHierarchy eh ON e.manager_id = eh.employee_id 247 | ) 248 | SELECT * FROM EmployeeHierarchy ORDER BY level, full_name; 249 | 250 | -- Set Operations (UNION, UNION ALL, INTERSECT, EXCEPT/MINUS) 251 | SELECT employee_id, first_name FROM employees WHERE department_id = 1 252 | UNION -- Combines results, removes duplicates 253 | SELECT employee_id, first_name FROM employees WHERE job_title LIKE '%Manager%' 254 | UNION ALL -- Combines results, keeps duplicates 255 | SELECT employee_id, first_name FROM employees WHERE salary > 100000 256 | INTERSECT -- Returns rows common to both queries 257 | SELECT employee_id, first_name FROM employees WHERE is_active = TRUE 258 | EXCEPT -- Returns rows from first query not in second (MINUS in Oracle) 259 | SELECT employee_id, first_name FROM employees WHERE hire_date < '2023-01-01'; 260 | 261 | 262 | -- Window Functions (ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, NTILE) 263 | SELECT 264 | employee_id, 265 | first_name, 266 | last_name, 267 | department_id, 268 | salary, 269 | RANK() OVER (PARTITION BY department_id ORDER BY salary DESC) AS salary_rank_in_dept, 270 | ROW_NUMBER() OVER (ORDER BY hire_date ASC) AS overall_hire_sequence, 271 | LAG(salary, 1, 0.0) OVER (PARTITION BY department_id ORDER BY hire_date) AS previous_employee_salary, 272 | LEAD(first_name) OVER (ORDER BY hire_date) AS next_hired_employee_name, 273 | NTILE(4) OVER (ORDER BY salary DESC) AS salary_quartile 274 | FROM 275 | employees; 276 | 277 | -- CASE Expressions 278 | SELECT 279 | employee_id, 280 | salary, 281 | CASE 282 | WHEN salary >= 100000 THEN 'High' 283 | WHEN salary >= 70000 AND salary < 100000 THEN 'Medium' 284 | ELSE 'Low' 285 | END AS salary_category, 286 | CASE job_title -- Simple CASE 287 | WHEN 'Software Engineer' THEN 'Tech Staff' 288 | WHEN 'HR Manager' THEN 'Admin Staff' 289 | ELSE 'Other' 290 | END AS job_type 291 | FROM 292 | employees; 293 | 294 | -- Using Built-in Functions (Date, String, Math, Conversion) 295 | SELECT 296 | CURRENT_DATE, -- Or GETDATE(), SYSDATE depending on DB 297 | CURRENT_TIMESTAMP, 298 | EXTRACT(YEAR FROM hire_date) AS hire_year, -- Or DATEPART(year, hire_date), YEAR() 299 | UPPER(first_name) AS upper_first_name, 300 | LOWER(last_name) AS lower_last_name, 301 | LENGTH(job_title) AS job_title_length, -- Or LEN() 302 | ROUND(salary / 12, 2) AS approx_monthly_salary, 303 | COALESCE(manager_id, 0) AS manager_id_no_null, -- Return first non-null value 304 | CAST(salary AS VARCHAR(20)) || ' USD' AS salary_string, -- Type casting 305 | CONVERT(VARCHAR(10), hire_date, 101) -- Example SQL Server style conversion 306 | FROM 307 | employees 308 | LIMIT 10 OFFSET 5; -- Or TOP 10, ROWNUM, etc. for limiting results 309 | 310 | -- ============================================================================= 311 | -- Transaction Control Language (TCL) 312 | -- ============================================================================= 313 | 314 | BEGIN TRANSACTION; -- Or START TRANSACTION 315 | 316 | SAVEPOINT before_promotion; -- Optional savepoint 317 | 318 | UPDATE employees SET salary = salary * 1.10 WHERE employee_id = 101; 319 | INSERT INTO employee_projects (assignment_id, employee_id, project_id, role_in_project) 320 | VALUES (5, 101, 3, 'Consultant'); -- Needs appropriate assignment_id handling 321 | 322 | -- Check conditions, potentially rollback 323 | -- ROLLBACK TO SAVEPOINT before_promotion; 324 | 325 | COMMIT; -- Make changes permanent 326 | 327 | -- Example of rollback 328 | BEGIN TRANSACTION; 329 | DELETE FROM projects WHERE project_name = 'Temporary Project'; 330 | -- Oups, deleted wrong project! 331 | ROLLBACK; -- Revert changes since BEGIN TRANSACTION 332 | 333 | -- ============================================================================= 334 | -- Data Control Language (DCL) - Syntax varies greatly 335 | -- ============================================================================= 336 | 337 | -- Granting Privileges 338 | GRANT SELECT, INSERT ON employees TO user_role; -- Or TO 'username'@'host' 339 | GRANT UPDATE (salary, job_title) ON employees TO hr_manager_role; 340 | GRANT ALL PRIVILEGES ON departments TO admin_user; 341 | GRANT EXECUTE ON FUNCTION calculate_bonus TO analyst_role; -- For functions/procedures 342 | 343 | -- Revoking Privileges 344 | REVOKE INSERT ON employees FROM user_role; 345 | REVOKE ALL PRIVILEGES ON departments FROM admin_user; 346 | 347 | -- ============================================================================= 348 | -- Stored Procedures, Functions, Triggers (Syntax HIGHLY database-specific) 349 | -- ============================================================================= 350 | 351 | -- Example: Function (PostgreSQL syntax) 352 | /* 353 | CREATE OR REPLACE FUNCTION calculate_bonus(emp_id INTEGER) 354 | RETURNS DECIMAL AS $$ 355 | DECLARE 356 | emp_salary DECIMAL; 357 | bonus DECIMAL; 358 | BEGIN 359 | SELECT salary INTO emp_salary FROM employees WHERE employee_id = emp_id; 360 | IF emp_salary > 100000 THEN 361 | bonus := emp_salary * 0.10; 362 | ELSE 363 | bonus := emp_salary * 0.05; 364 | END IF; 365 | RETURN bonus; 366 | END; 367 | $$ LANGUAGE plpgsql; 368 | */ 369 | 370 | -- Example: Stored Procedure (SQL Server syntax) 371 | /* 372 | CREATE PROCEDURE PromoteEmployee (@EmployeeID INT, @NewJobTitle VARCHAR(50), @SalaryIncrease DECIMAL(10,2)) 373 | AS 374 | BEGIN 375 | SET NOCOUNT ON; 376 | UPDATE employees 377 | SET job_title = @NewJobTitle, 378 | salary = salary + @SalaryIncrease 379 | WHERE employee_id = @EmployeeID; 380 | 381 | IF @@ROWCOUNT = 0 382 | BEGIN 383 | RAISERROR('Employee not found or no update occurred.', 16, 1); 384 | RETURN; 385 | END 386 | END; 387 | */ 388 | 389 | -- Example: Trigger (Generic Concept - syntax varies widely) 390 | /* 391 | CREATE TRIGGER UpdateAuditLog 392 | AFTER UPDATE ON employees 393 | FOR EACH ROW -- Or FOR EACH STATEMENT 394 | BEGIN 395 | -- Trigger logic, e.g., insert into an audit table 396 | -- INSERT INTO audit_log (table_name, record_id, change_time, user) 397 | -- VALUES ('employees', NEW.employee_id, CURRENT_TIMESTAMP, CURRENT_USER); 398 | END; 399 | */ 400 | 401 | -- ============================================================================= 402 | -- Dropping Objects 403 | -- ============================================================================= 404 | 405 | -- Drop view, index, tables (in reverse order of dependency or using CASCADE) 406 | DROP VIEW IF EXISTS employee_department_view; 407 | DROP INDEX IF EXISTS idx_employee_name; 408 | DROP INDEX IF EXISTS idx_project_name; 409 | 410 | -- May need CASCADE depending on FK constraints and DB system if data exists 411 | DROP TABLE IF EXISTS employee_projects; 412 | DROP TABLE IF EXISTS projects CASCADE; -- Example cascade 413 | DROP TABLE IF EXISTS employees; 414 | DROP TABLE IF EXISTS departments; 415 | 416 | DROP SCHEMA IF EXISTS company_schema; 417 | -- DROP SEQUENCE IF EXISTS employee_id_seq; 418 | 419 | -- End of Script -------------------------------------------------------------------------------- /tests/file.svelte: -------------------------------------------------------------------------------- 1 | 28 | 29 | 41 | 42 |
    43 |
  • {n}
  • 44 |
    45 | 46 | 47 |
    48 |
    49 | 50 | 51 |
    52 |
    53 | 54 | 38 | 39 | 40 | 41 | 42 |
    Type A Content
    43 |
    Type B Content
    44 |
    Fallback Content
    45 | 49 | 50 |
      51 |
    • 52 | {{ item.text }} 53 |
    • 54 |
    55 |
      56 |
    • 57 | {{ index }}. {{ key }}: {{ value }} 58 |
    • 59 |
    60 | {{ n }} 61 | 65 |
    66 | {{ item.text }} (Even ID) 67 |
    68 | 69 |

    This paragraph is controlled by v-show.

    70 | 71 |
    72 | 73 |
    {{ This will not be compiled }}
    74 | 75 |
    This content will only render once: {{ initialValue }}
    76 | 77 |
    This is hidden until Vue is ready.
    78 | 79 | 80 | 81 | 82 | 88 | 89 | 90 | 91 | 92 |

    This goes into the default slot.

    93 | 94 | 97 | 98 | 101 | 102 | 105 |
    106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 |

    Fading paragraph

    114 |
    115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 126 | 129 | 130 |
    131 | 132 | 133 | 388 | 389 | 400 | 401 | 501 | 502 | 510 | -------------------------------------------------------------------------------- /tests/vue3B.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 99 | -------------------------------------------------------------------------------- /theme-compiler.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs' 2 | 3 | const sourcePath = './source' 4 | const { files, folders } = getFilesAndFoldersFromPath(sourcePath) 5 | 6 | if (process.argv[2] === 'dev') { 7 | for (let folder of [sourcePath, ...folders]) { 8 | fs.watch(folder, async () => { 9 | try { 10 | await compile() 11 | } catch (e) { 12 | console.error(e) 13 | } 14 | }) 15 | } 16 | await compile() 17 | } else if (process.argv[2] === 'prod') { 18 | await compile() 19 | process.exit() 20 | } 21 | 22 | async function compile() { 23 | // Filter the array directly using the constant prefix 24 | const themeVersions = files.filter( 25 | (path) => path.replace(sourcePath + '/', '').indexOf('/') === -1, 26 | ) 27 | 28 | for (let themeVersionPath of themeVersions) { 29 | try { 30 | const [versionName] = themeVersionPath.replace('.js', '').split('/').slice(-1) 31 | const versionConstructor = await getImportDefault(themeVersionPath) 32 | 33 | const colorsPath = files.find( 34 | (path) => path.includes(versionName) && path.includes('/colors/'), 35 | ) 36 | const baseColors = await getImportDefault(colorsPath) 37 | 38 | const variantsPaths = files.filter( 39 | (path) => path.includes(versionName) && path.includes('/variants/'), 40 | ) 41 | 42 | for (let variantPath of variantsPaths) { 43 | try { 44 | const [variantName] = variantPath.replace('.js', '').split('/').slice(-1) 45 | const variantFileName = `night-wolf-${variantName}` 46 | const variantFileNameNi = `${variantFileName}-noitalics` 47 | const variantModifier = await getImportDefault(variantPath) 48 | const varianColors = variantModifier(baseColors) 49 | const variant = versionConstructor(varianColors) 50 | const variantStringified = JSON.stringify({ name: variantFileName, ...variant }) 51 | const variantStringifiedNi = JSON.stringify( 52 | { name: variantFileNameNi, ...variant }, 53 | (key, value) => 54 | key === 'fontStyle' && value === 'italic' ? 'normal' : value, 55 | ) 56 | fs.writeFileSync(`./themes/${variantFileName}.json`, variantStringified) 57 | fs.writeFileSync(`./themes/${variantFileNameNi}.json`, variantStringifiedNi) 58 | console.info( 59 | `${variantFileName}.json and ${variantFileNameNi}.json files compiled!`, 60 | ) 61 | } catch (e) { 62 | console.error(e) 63 | } 64 | } 65 | } catch (e) { 66 | console.error(e) 67 | } 68 | } 69 | console.info('----------------done----------------') 70 | console.info('') 71 | } 72 | 73 | function getFilesAndFoldersFromPath(path) { 74 | const result = { files: [], folders: [] } 75 | const subPaths = fs.readdirSync(path) 76 | subPaths.forEach((subPath) => { 77 | const fullPath = `${path}/${subPath}` 78 | if (fs.statSync(fullPath).isDirectory()) { 79 | result.folders.push(fullPath) 80 | const subResult = getFilesAndFoldersFromPath(fullPath) 81 | result.files.push(...subResult.files) 82 | result.folders.push(...subResult.folders) 83 | } else { 84 | result.files.push(fullPath) 85 | } 86 | }) 87 | return result 88 | } 89 | 90 | async function getImportDefault(path) { 91 | return (await import(`${path}?t=${Date.now()}&r=${Math.random()}`)).default 92 | } 93 | -------------------------------------------------------------------------------- /themes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mao-santaella-rs/NightWolfTheme/fc1d0b70c889ecedf7d3224f7ed08a7a7c002f90/themes/.gitkeep --------------------------------------------------------------------------------