branch: externals/phps-mode commit 1eb1866f96484cf32cf7def1c2cda9b7fd9c6c44 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Removed obsolete docs --- docs/development.md | 71 --------------------- docs/heuristics.md | 22 ------- docs/imenu.md | 24 ------- docs/indentation.md | 176 ---------------------------------------------------- 4 files changed, 293 deletions(-) diff --git a/docs/development.md b/docs/development.md deleted file mode 100644 index ea2df5e686..0000000000 --- a/docs/development.md +++ /dev/null @@ -1,71 +0,0 @@ -# Development - -Make pull requests to `develop` branch or branches forked from develop branch. Tested changes that are considered improvements are merged to master. Make sure to sign the FSF-papers as well. - -## Tests - -If you have emacs at a customized location prefix the commands with your path, i.e. - -`export emacs="~/Documents/emacs/src/emacs" && make tests` - -Run all tests with `make tests`. - -### Functions - -Indentations, incremental processes, Imenu-support. - -``` bash -make test-functions -``` - -### Integration - -This should test all other parts in collaboration. - -``` bash -make test-integration -``` - -### Lexer - -Lexer token generation. - -``` bash -make test-lexer -``` - -### Parser - -Semantic grammar. Not ready yet. - -``` bash -make test-parser -``` - -### Syntax-table - -Basic point and region behaviour. - -``` bash -make test-syntax-table -``` - -## Byte-compilation - -Plug-in should support byte-compilation and it is recommended. - -### Compile - -``` bash -make compile -``` - -### Clean - -``` bash -make clean -``` - - - -[Back to start](../../../) diff --git a/docs/heuristics.md b/docs/heuristics.md deleted file mode 100644 index 7a75eccd0a..0000000000 --- a/docs/heuristics.md +++ /dev/null @@ -1,22 +0,0 @@ -# Heuristics - -These should solve the problem of freezing editor for too long when making small changes to large files. Otherwise a full incremental re-parse would be triggered more often than necessary. - -## Indenting - -When indenting a line, calculate difference in white-space and change indexes of buffer after point correspondingly. - -## Incremental - -When user has done other changes, determine unchanged previous position R, determine changed maximum position X, determine new buffer length L. Do incremental lex from R to X. - -### State preserving changes - -If new states at X equals old states at X just move all indexes with delta X, otherwise do incremental lex of rest of buffer. - -### State disrupting changes - -Otherwise continue with incremental lex of rest of buffer. - - -[Back to start](../../../) diff --git a/docs/imenu.md b/docs/imenu.md deleted file mode 100644 index 1603078cf3..0000000000 --- a/docs/imenu.md +++ /dev/null @@ -1,24 +0,0 @@ -# Imenu algorithm - -## Description - -This file explains with psuedo-code how the imenu generation algorithm works. - -## Psuedo-code - -``` -for token in tokens: - - if token is "{": - nesting-level + 1; - endif; - if token is "}": - nesting-level - 1; - endif; - - - -endfor; -``` - -[Back to start](../../../) diff --git a/docs/indentation.md b/docs/indentation.md deleted file mode 100644 index 012fcdd525..0000000000 --- a/docs/indentation.md +++ /dev/null @@ -1,176 +0,0 @@ -# Indentation algorithm - -Document describing indentation algorithm. - -## Terminology - -* `nesting`: sum of all kinds of open brackets -* `nesting-stack`: contains nesting-levels before indentation was increased -* `nesting-start`: nesting-level at the beginning of the last line -* `nesting-end`: nesting-level at the end of the last line -* `nesting-stack-start`: nesting-start at top of stack -* `nesting-stack-end`: nesting-end at top of stack - -## Algorithm - -Here follows pseudo-code for a algorithm that calculates indentation for each line in buffer. Tokens are from the official re2c PHP lexer. - -```php -foreach token in buffer: - - if token = T_START_HEREDOC: - in-heredoc = true; - in-heredoc-started-this-line = true; - elseif token == T_END_HEREDOC: - in-heredoc = false; - in-heredoc-ended-this-line = true; - endif; - - calculate nesting-end; - - if nesting-stack AND nesting-end <= nesting-stack-start: // #decrease - pop stack; - - if first-token-on-line-is-nesting-decrease: - indent--; - else: - if !temp-post-indent: - temp-post-indent = indent; - endif; - - temp-post-indent--; - endif; - - endif; - - if we reached end of a line: - - if this-token or last token is a dot: - concatentation-level = 1; - else: - concatentation-level = 0; - endif; - - indent-start = indent; - - if new-token-line-start is more than one line after last-token-line-start AND token is not T_CLOSE_TAG: - foreach line between last-token-line-start and new-token-line-start: - save line indent-start - endforeach; - endforeach; - - if temp-pre-indent: // #temp-pre-indent - indent-start = temp-pre-indent; - endif; - - if (in-heredoc AND !in-heredoc-started-this-line) OR in-heredoc-ended-this-line: - indent-start = 0; - endif; - - save line indent-start; // #save - - if temp-post-indent: #temp-post-indent - indent = temp-post-indent; - endif; - - if nesting-end > 0 AND (!nesting-stack OR nesting-end > nesting-stack-end): // #increase - if !nesting-stack: - nesting-stack-end = 0; - endif; - - push (nesting-stack-end nesting-end) to stack; - indent++; - endif; - - indent-end = indent; - if token-end-line-number > token-start-line-number: - if (in-heredoc AND !in-heredoc-started-this-line) OR in-heredoc-ended-this-line: - indent-end = 0; - endif; - - if token = T_DOC_COMMENT: - tuning-level = 1; - endif; - - foreach line between token-start-line-number to token-end-line-number: - save line indent-end tuning-level; - endforeach; - endif; - - in-heredoc-started-this-line = false; - in-heredoc-ended-this-line = false; - first-token-on-line = true; - - else: - if token != T_OPEN_TAG AND token != T_OPEN_TAG_WITH_ECHO: - first-token-on-line = false; - endif; - endif; - -endforeach; -``` - -## Examples - -PHP examples using algorithms defined above, explained each line. - -## Basic multi-line if-expression 1 - -```php // #save indent: 0 -if (function( // #save indent: 0, #increase push (0 2) indent: 1 - false) // #save indent: 1 -) { // #decrease pop (0 2) indent: 0, #save indent: 0, #increase push (0 1) indent: 1 - echo true; // #save indent: 1 -} // #decrease pop (0 1) indent: 0, #save indent: 0 -``` - -## Basic multi-line if-expression 2 - -```php // #save indent: 0 -if (function( // #save indent: 0, #increase push (0 2) indent: 1 - false)) { // #decrease pop (0 2) temp-post-indent: 0, #save indent: 1, #temp-post-indent indent: 0, #increase push (0 1) indent: 1 - echo true; // #save indent: 1 -} // #decrease pop (0 1) indent: 0, #save indent: 0 -``` - -## Inline control structure for if-else - -```php // #save indent: 0 -if (true) // #save indent: 0 - echo true; // #temp-pre-indent: 1, #save indent: 1 -else // #save indent: 0 - echo false; // #temp-pre-indent: 1, #save indent: 1 -``` - -## Alternative control structure for if-else 2 - -```php // #save indent: 0 -if (true && // #save indent: 0, #increase push (0 1) indent: 1 - true // #save indent: 1 -): // #decrease pop (0 1) indent: 0, #save indent: 0, #increase push (0 1) indent: 1 - echo true; // #save indent_ 1 -elseif (true // #decrease pop (0 1) indent: 0, #save indent: 0, #increase push (0 1) indent: 1 - || false): // #decrease pop (0 1) indent: 0, #save indent: 0, #increase push (0 1) indent: 1 - echo 'another'; // #save indent: 1 -else: // #decrease pop (0 1) indent: 0, #save indent: 0, #increase push (0 1) indent: 1 - echo false; // #save indent: 1 -endif; // #decrease pop (0 1) indent: 0, #save indent: 0 -``` - -## Multi-line assignments 1 - -```php -<?php // #save indent: 0 -$var = array( // #save indent: 0, #increase push (0 2) indent: 1 - 'def' // #save indent: 1 -); // #decrease pop (0 2) indent: 0, #save indent: 0 -``` - -## Multi-line assignments 2 - -```php -<?php // #save indent: 0 -$var = 'abc' // #save indent: 0, #increase push (0 1) indent: 1 - . 'def' // #save indent: 1 - . 'ghj'; // #decrease pop (0 1) indent: 0, #save indent: 0 /* ERROR */ -```