Browse Source

Changed project name to Lit lol

main
Dustin Wilson 3 years ago
parent
commit
5edc6d32b3
  1. 4
      README.md
  2. 2
      lib/Grammar/Data.php
  3. 2
      lib/Grammar/Registry.php
  4. 2
      lib/Grammar/Tokenizer.php
  5. 17
      lib/Highlight.php
  6. 14
      lib/Highlighter.php
  7. 2
      lib/Scope/Data.php
  8. 2
      lib/Scope/Exception.php
  9. 2
      lib/Scope/Matcher.php
  10. 2
      lib/Scope/Matchers/AndMatcher.php
  11. 2
      lib/Scope/Matchers/GroupMatcher.php
  12. 2
      lib/Scope/Matchers/NegateMatcher.php
  13. 2
      lib/Scope/Matchers/OrMatcher.php
  14. 2
      lib/Scope/Matchers/PathMatcher.php
  15. 2
      lib/Scope/Matchers/ScopeMatcher.php
  16. 3
      lib/Scope/Parser.php

4
README.md

@ -2,6 +2,6 @@
[b]: https://github.com/atom/highlights
[c]: https://macromates.com
# Fukkus #
# Lit #
Fukkus is a multilanguage syntax highlighter written in PHP. It takes code as input and returns HTML with classes based upon tokens in the code. It is loosely based upon [Atom][a]'s [Highlights][b] which is used in the Atom text editor to syntax highlight code. Atom's Highlights is in turn based upon [TextMate][c]'s syntax highlighting using its concepts of scope selectors and common classes for components of programming languages.
Lit is a multilanguage syntax highlighter written in PHP. It takes code as input and returns HTML with classes based upon tokens in the code. It is loosely based upon [Atom][a]'s [Highlights][b] which is used in the Atom text editor to syntax highlight code. Atom's Highlights is in turn based upon [TextMate][c]'s syntax highlighting using its concepts of scope selectors and common classes for components of programming languages.

2
lib/Grammar/Data.php

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Grammar;
namespace dW\Lit\Grammar;
class Data {
public static function withFile(string $filepath): \Generator {

2
lib/Grammar/Registry.php

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Grammar;
namespace dW\Lit\Grammar;
class Registry {
protected static array $grammars = [];

2
lib/Grammar/Tokenizer.php

@ -4,6 +4,6 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Grammar;
namespace dW\Lit\Grammar;
class Tokenizer {}

17
lib/Highlight.php

@ -0,0 +1,17 @@
<?php
/** @license MIT
* Copyright 2021 Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Lit;
class Highlight {
public static function withFile(string $filename): string {
$data = Grammar\Data::withFile($filename);
}
public static function withString(string $string): string {
$data = Grammar\Data::withString($string);
}
}

14
lib/Highlighter.php

@ -1,14 +0,0 @@
<?php
/** @license MIT
* Copyright 2021 Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus;
class Highlighter {
public static function highlightString(string $string): string {
$data = Grammar\Data::fromString($string);
}
}

2
lib/Scope/Data.php

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Scope;
namespace dW\Lit\Scope;
/**
* Tokenizes scope strings into an array of segments of the original string and

2
lib/Scope/Exception.php

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Scope;
namespace dW\Lit\Scope;
class Exception extends \Exception {
const MESSAGE = "%s expected; found %s at offset %s\n";

2
lib/Scope/Matcher.php

@ -4,6 +4,6 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Scope;
namespace dW\Lit\Scope;
abstract class Matcher {}

2
lib/Scope/Matchers/AndMatcher.php

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Scope;
namespace dW\Lit\Scope;
class AndMatcher extends Matcher {
protected array $matchers = [];

2
lib/Scope/Matchers/GroupMatcher.php

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Scope;
namespace dW\Lit\Scope;
class GroupMatcher extends Matcher {
protected string|null $prefix;

2
lib/Scope/Matchers/NegateMatcher.php

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Scope;
namespace dW\Lit\Scope;
class NegateMatcher extends Matcher {
protected Matcher $matcher;

2
lib/Scope/Matchers/OrMatcher.php

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Scope;
namespace dW\Lit\Scope;
class OrMatcher extends Matcher {
protected array $matchers = [];

2
lib/Scope/Matchers/PathMatcher.php

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Scope;
namespace dW\Lit\Scope;
class PathMatcher extends Matcher {
protected string|null $prefix;

2
lib/Scope/Matchers/ScopeMatcher.php

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Scope;
namespace dW\Lit\Scope;
class ScopeMatcher extends Matcher {
protected array $segments;

3
lib/Scope/Parser.php

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Fukkus\Scope;
namespace dW\Lit\Scope;
/** Parses scope strings into a matcher tree */
class Parser {
@ -92,7 +92,6 @@ class Parser {
} elseif (!in_array($peek, [ '-', false ]) && strspn($peek, self::SCOPE_MASK) === strlen($peek)) {
$result = self::parsePath($prefix);
} else {
if (!in_array($peek, [ '-', false ]) && )
// TODO: Take the effort to make this more descriptive
self::throw([ 'Group', 'Path', 'Scope' ], $peek);
}

Loading…
Cancel
Save