Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render file load #3

Merged
merged 5 commits into from Mar 4, 2019
Merged

Render file load #3

merged 5 commits into from Mar 4, 2019

Conversation

loganwright
Copy link
Member

No description provided.

Copy link
Member

@tanner0101 tanner0101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great, LMK if you want me to write the Encoder

return true
}

/// Strict compare
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to get this for free if TemplateDataStorage conforms to Equatable

import Foundation

/// Capable of being encoded as `TemplateData`.
public protocol TemplateDataRepresentable {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been trying to move away from this pattern recently because I'm not a fan of how it pollutes the standard library types. Being able to call "foo".convertToTemplateData() from everywhere doesn't seem very Swifty.

I think a better pattern is using inits:

let data = TemplateData(string: "foo")

This method is less generally useful, but that comes with benefits too. Like not needing to use try when creating template data from a String.

@@ -7,51 +7,17 @@ public struct LeafConfig {
}

protocol LeafCache {
func insert(_ document: ResolvedDocument)
func load(name: String) throws -> EventLoopFuture<ResolvedDocument>
func insert(_ document: ResolvedDocument, on loop: EventLoop) -> EventLoopFuture<ResolvedDocument>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would cache operations need to be async? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't know, but I figured it might be easier to go async to sync than the other way around, I guess..

what do youthink?

#warning("TODO: resolve import / extend / static embed")
throw "todo: serialize"
return syntax.flatMap { syntax in
let dependencies = self.readDependencies(syntax.dependencies)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe syntax.dependencies could be declared here or as a part of ExtendResolver somehow? That functionality seems like it will only be used by this code, so having to hunt down the extension is not ideal.

@tanner0101 tanner0101 added the enhancement New feature or request label Feb 28, 2019
@tanner0101 tanner0101 added this to In Progress in Vapor 4 via automation Feb 28, 2019
@loganwright loganwright merged commit c35e48b into syntax-parse Mar 4, 2019
@penny-coin
Copy link

Hey @loganwright, you just merged a pull request, have a coin!

You now have 519 coins.

Vapor 4 automation moved this from In Progress to Done Mar 4, 2019
@tanner0101 tanner0101 deleted the render-file-load branch March 5, 2019 20:47
loganwright added a commit that referenced this pull request Apr 11, 2019
* remove a bit of recursion

* adding whitespace to lexer in parameters context

* some preprocess stuff working

* very much in progress going to try lexing out parameters

* seems to be parsing out properly

* will need to parse out and collect nested tags

* prints are no good, but working parsing

* preprocessing

* fixed lexer tests passing

* final test fixes

* cleaning up parser

* more parser cleanup

* trying more complex syntax

* more syntax comprehension

* more syntax comprehension

* more syntax comprehension

* syntax parsing complete, ready for compilation

* compilation and body collection starting

* making elements successfully

* parsing body and tests passing

* going to stick to linear syntax parsing, and group into blocks after

* evaluated code blocks

* adding types to alternate syntax

* finally added depth logging for better visualization

* adding more syntax comprehension

* preparing conditional chaining

* proper conditional linking

* conditionals linked properly

* loop ast and passing tests

* everything is printing well

* saving some progress on printing, need to build it out proper

* locking in parser

* updated to custom tag object

* removing extraneous syntax helpers

* code removal

* code removal building

* removing more

* more removals

* more

* parserr dead code done

* beginning extension resolutions

* light extension satisfaction start

* rsolving extensions

* compiling out extensions

* resolver tests passing

* starting w/ document resolver

* lazy resolution of inserted documents easier testing and manual uses

* better insert support for document loader

* removing dead code and some cleanup

* rename altParse => parse vestigial

* tests building, func name change

* improve printing to proper indent list

* all tests are now passing

* extend now logs alphabetical for clarity

* more little test cleanup

* more print testing

* moving to extend resolver more explicit

* privatize some things

* moving open context to val

* Render file load (#3)

* starting to prep serializer

* add template data object

* rough data object building

* async render file load recursive

* rm extraneous

* Serialize (#4)

* starting serialization on foor loops

* initial serialization working.. for loop render

* adding loop helpers, isfirst, islast

* use custom tag in processed param

* starting a bit of custom tag resolution

* adding demo custom tag lowercased

* conditional statements working

* slight test adjustment

* using alternative render for custom tags

* starting custom tag serialization

* expression resolution working w/ custom tags

* more moves to template data

* cleanup

* add serializer to render step

* cleaning up old leafdata in tests

* removing dead code

* make todo

* supporting nested params w parantheticals

* add + operator

* some slight renames and obs

* template data to leaf data

* parameter resolution supporting basic math operators

* update nio thread pool name

* [wip] (#8)

* lexer is building w characters

* tests passing w/ conversion to character

* modifiable global tag indicator

* adding column tracking and more lexer info

* lexer errors flushed out

* removing old leaf error

* name clarification regarding parameter declarations

* publicizing

* discard old error

* lexer error includes already lexed tokens for debugging

* slight test tweaks

* nio to 2.0 resolve
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Vapor 4
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants